Re: Using NSBundle
Re: Using NSBundle
- Subject: Re: Using NSBundle
- From: Sherm Pendley <email@hidden>
- Date: Sat, 19 Nov 2005 13:35:54 -0500
On Nov 19, 2005, at 6:20 AM, Graham J Lee wrote:
as the screen saver only has one bundle, then [NSBundle mainBundle]
ought to return the right bundle. Is that not true?
No, it's not true. A screen saver has multiple bundles, and
your .saver bundle is not the main bundle. The main bundle is the
host application, which might be either ScreenSaverEngine.app or
System Preferences.app, depending on whether you're running in
preview mode or not.
To get an NSBundle instance that corresponds to your .saver bundle,
you need to use another method. Either of these should work:
[NSBundle bundleForClass:[self class]]
[NSBundle bundleWithIdentifier:@"com.invalid.myidentifier"];
Obviously, if you use +bundleWithIdentifier:, you need to use the
correct identifier instead of the example. ;-)
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden