Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image in bundle not found using NSBundle

So here's the deal: I have an image in the Resources folder of custom framework that I use as a default for classes in the framework. However, when I create these classes in projects that link against my framework they fail saying they can't find the image. I'm guessing the NSBundle's +mainBundle does not search the correct paths for my classes to find this image when linked in a different project. Is this correct? If so, where should I be looking for my image? I hope this makes sense (it's awfully late) and thanks for the help!

like image 683
Grimless Avatar asked Jan 19 '26 08:01

Grimless


1 Answers

For an application, the +mainBundle will be the application bundle (e.g., Foo.app). Frameworks are their own bundle, which you can find using +bundleForClass: or +bundleWithIdentifier:.

like image 187
Jason Foreman Avatar answered Jan 21 '26 22:01

Jason Foreman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!