• 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 resources to the Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding resources to the Application


  • Subject: Re: Adding resources to the Application
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 14 Jul 2005 14:23:38 -0400

On Jul 14, 2005, at 1:25 PM, Nik Bauman wrote:

So I have a giant plist file that I want inside my application bundle,
but I'm having trouble figuring out how to access it.

I have the plist in the "Resources" folder within Xcode, but how do I
access this file programatically now?

NSBundle is your friend:

NSBundle *mb = [NSBundle mainBundle];
NSString *path = [mb pathForResource:@"giant" ofType:@"plist"];

There are lots of variant -pathForResource:ofType: methods, for looking in other bundles, returning more than one path, looking for localized resources, etc. Have a look at NSBundle docs for details.

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: 
 >Adding resources to the Application (From: Nik Bauman <email@hidden>)

  • Prev by Date: [Spotlight API] Will file names be indexed ever?
  • Next by Date: Re: [RESOLVED] process events in tight loop?
  • Previous by thread: Re: Adding resources to the Application
  • Next by thread: [Spotlight API] Will file names be indexed ever?
  • Index(es):
    • Date
    • Thread