Build Cocoa application Bundle with private dylib/framework
In my development Mac, I put the dylib in the /usr/local/lib directory, and drag it into the project.
The app is compiled and runs perfect on my computer.
To distribute this app to the other Mac, I create a copy Files building phase, and say “copy that dylib to Frameworks directory”.
The application is built successfully, and I indeed see the dylib is copied to the Frameworks directory in the app bundle.
The problem is when I run this app in another regular Mac, which does not have this dylib installed. I get an error saying:
dyld: Library not loaded: /usr/local/lib/mylib.dylib
- How to enable build timing in Xcode?
- Xcode 4 target build setting “Skip install”. What is it?
- Xcode stack trace not appearing in console
- Xcode cannot run using the selected device after upgrade to Xcode 5.0
- Which optimization level should I choose for release?
- How to force xcode to use ARC on a specific file?
Solutions Collect From Internet About “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:
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:
@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.
- “Internal server error” when migrating Parse to Heroku/AWS
- UIview animatewithDuration does not works in swift
- iOS 6 Accounts framework error: Prefix attribute must be followed by an interface or protocol
- swift How to remove optional String Character
- How do I export a public key <SecKey> that was generated using SecKeyGeneratePair to be used on a server?
- How to add UITabbarController to UIViewController in iOs
- PhoneGap Xcode Missing Header files on Build 'Cordova/CDVViewController.h' file not found
- How do I delete trailing zeros on floats without rounding in Objective-C?
- Locate source project directory in Swift from compiled code
- What is the purpose of willSet and didSet in Swift?
- Provisioning profile doesn't include the com.apple.security.application-groups entitlement
- iOS Dropbox SDK – Cannot upload or get metadata
- Add just a top border to an UIView with Quartzcore/layer?
- Dynamic layout for Multilple iOS devices?
- What is the type of SCNVector3 components? CGFloat or Float?