• 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
Framework project config & accessing resources in the framework bundle.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Framework project config & accessing resources in the framework bundle.


  • Subject: Framework project config & accessing resources in the framework bundle.
  • From: Nelson Santos <email@hidden>
  • Date: Sat, 10 Mar 2007 09:33:19 -0500

Hi all,

I have created a framework project. I set the target's build option entitled "Deployment Location" to checked and left the "Installation Directory" to the default value of /Users/Nelson/Library Frameworks. I build my project and the resulting framework bundle gets built in the installation directory just fine. So far so good.

I created another project of type Cocoa Application. I did Add To Project and selected the Framework file in the user library frameworks directory mentioned above. I also added the framework project (xcodeproj) file to this project. I then made this project dependent on the framework project in the Target Info window General tab. I also added a new copy files build stage so that the framework bundle is copied into my app bundle. I compile this project and everything runs OK. All methods defined in the framework are accessible and work. So far so good, again.

Here is what I can't figure out: In the framework project (and in the resulting framework bundle that is built), I've got some resources I would like to access from Cocoa application. The Cocoa app should look for those resources within the frameworks/ My.framework/resources folder within the app bundle. What is the proper way to do it?

The only successful way that I've managed to do it is with the following code from within my Cocoa project:

NSBundle *bundle = [NSBundle bundleForClass:[MyFrameworkClass class]];
NSString *path = [bundle pathForResource:@"AFileInTheFrameworkBundle" ofType:@"plist"];


This works fine, but upon examining the resulting bundle path and the resource path, I noticed that they point to the framework bundle located in my user library frameworks directory. I don't want that. I want it to fetch the resource from the framework folder found inside the cocoa application bundle that I am building. My understanding of the search tree is that a framework is first searched for within the App bundle (and it is indeed there). But it's not doing that.

Which leads me to believe that I did something wrong. Can anyone point out my error or missed step?

Thanks!

Nelson Santos
www.prismaticrealms.com


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Framework project config & accessing resources in the framework bundle.
      • From: Chris Hanson <email@hidden>
    • Re: Framework project config & accessing resources in the framework bundle.
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: a HUGE Core Data bug
  • Next by Date: PDFView setDocument: autorelease crash?
  • Previous by thread: NSMenuItem events
  • Next by thread: Re: Framework project config & accessing resources in the framework bundle.
  • Index(es):
    • Date
    • Thread