• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: adding an additional plist files as resources? possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding an additional plist files as resources? possible?


  • Subject: Re: adding an additional plist files as resources? possible?
  • From: Larry Fransson <email@hidden>
  • Date: Mon, 27 Sep 2004 19:31:10 -0700


On Sep 27, 2004, at 18:21, Ken Hawkins wrote:

i just copied the plist into the resources dir at build time and then


infoDictionary = [NSDictionary dictionaryWithContentsOfFile:@"subjects.plist"];
// If we succeeded, look for our property.
if ( infoDictionary != NULL ) {


subjects = [infoDictionary objectForKey:@"BJSubjectTypes"];


NSLog([subjects description]);
}

You might want to look at NSBundle's -pathForResource:ofType:. That's generally the way you should look for resources in the application bundle. I would not have expected your method to work - at least not without a better defined path that specifically references the Resources directory in the app bundle - and I don't know that I would always count on it to work. Using the NSBundle method, your line above would look like this:

infoDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"subjects" ofType:@"plist"]];

And, FWIW, this question would have been better directed to a Cocoa list than the Xcode users list.

Larry Fransson
Seattle, WA
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >adding an additional plist files as resources? possible? (From: Ken Hawkins <email@hidden>)
 >Re: adding an additional plist files as resources? possible? (From: Ken Hawkins <email@hidden>)

  • Prev by Date: Re: adding an additional plist files as resources? possible?
  • Next by Date: Xcode and Project dependencies
  • Previous by thread: Re: adding an additional plist files as resources? possible?
  • Next by thread: Re: adding an additional plist files as resources? possible?
  • Index(es):
    • Date
    • Thread