• 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: Using NSBundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Using NSBundle (From: Graham J Lee <email@hidden>)

  • Prev by Date: Re: adding Foundation framework to a Carbon application
  • Next by Date: V.simple nstreecontroller example?
  • Previous by thread: Re: or Using NSImage... [was: Re: Using NSBundle]
  • Next by thread: The best way to learn about low level Thread
  • Index(es):
    • Date
    • Thread