Reputation: 8907
I'm trying to add SDL and SDL_ttf frameworks to my application and I've done it the usual way: added them in the "Link Binaries with Libraries" section and added a copy files phase that copies them to the Frameworks directory. This does create a app bundle with embedded frameworks. However, when I run the application, I get this error:
dyld: Library not loaded: @rpath/SDL_ttf.framework/Versions/A/SDL_ttf Referenced from: /Users/matthew.davies/Library/Developer/Xcode/DerivedData/MacHub-ambfqujqxbxyiqapaoctvsucpdeu/Build/Products/Release/MacHub.app/Contents/MacOS/MacHub Reason: image not found
I am not sure what else to do so that the app can find the frameworks despite being embedded in its bundle.
Any ideas please?
Upvotes: 9
Views: 6092
Reputation: 8907
I discovered the reason why in a comment on a webpage. I needed to set the "Runpath Search Paths" build setting to "@loader_path/../Frameworks" and the frameworks are found.
Why frameworks are not automatically searched for in the Frameworks directory of an app bundle is a complete mystery to me? Are you listening Apple? :)
Upvotes: 7