Build Cocoa application Bundle with private dylib/framework Build Cocoa application Bundle with private dylib/framework objective-c objective-c

Build Cocoa application Bundle with private dylib/framework


The issue comes from the fact that you copy the framework into the app bundle, so it is available at a location like:

 <you_app_path>/Contents/Frameworks

but you try to load it from /usr/local/lib where it is not available on you deployment machine. From Apple Framework Programming Guide:

To embed a framework in an application, there are several steps you must take:

You must configure the build phases of your application target to put the framework in the correct location.

You must configure the framework target’s installation directory, which tells the framework where it will live.

You must configure the application target so that it references the framework in its installation directory.

Now, you say that the build phase is ok; I assume also that you sent the application target build setting correctly. What is left is configuring the framework target’s installation directory.

If you did not build the framework yourself, you should be able to fix this by changing the framework install path so that it is defined relative to the loader (your app), to something like: @loader_path/../Frameworks/ (or @executable_path/../Frameworks). You can do that by means of install_name_tool.

If you are compiling on your own the private framework, you can define its install location in Xcode build settings.