Re: adding an additional plist files as resources? possible?
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