Saturday, 15 January 2011

osx - Get the URL for a resource in an OS X framework -



osx - Get the URL for a resource in an OS X framework -

i want url core info model have in os x framework. i've tried using [nsbundle mainbundle] urlforresource]... bundle gets running application not framework.

so whats right way ?

solution

you need class (any) in framework , can utilize that

class frameworkclass = ... //(self.class or nsclassfromstring or [myclass class]) nsbundle *frameworkbundle = [nsbundle bundleforclass:frameworkclass]; nsurl *url = [frameworkbundle urlforresource:...]; example.

i have class in 1 of frameworks:

nsbundle *bundle = [nsbundle bundleforclass:[self class]]; nsurl *url = [bundle urlforresource:@"image" withextension:@"jpg"];

osx cocoa frameworks

No comments:

Post a Comment