I have created a Mac app which uses the RMSharedPreferences framework. When opening the app, it immediately crashes and I get the following error:
Dyld Error Message:
Library not loaded: @rpath/RMSharedPreferences.framework/Versions/A/RMSharedPreferences
Referenced from: /Users/USER/Desktop/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
It seems that it can't find the framework. I have tried adding a copy files phase to the target which should copy the framework and when browsing the contents of the app in Finder, it seems that it is copied correctly.
Does anyone know what might cause this error?
EDIT: Setting the framework to optional does make the application launch without any errors but the application does not fully work. Any RMSharedPreferences related calls will be ignored.
XCode is compatible with C, C++ and Objective C as well as Swift. Objective C is based on C. You can execute any C program in XCode as long as it does not have any platform specific dependencies that would prevent it from running on an Apple device / computer.
Binary Frameworks A binary framework is already compiled source code with resources with a defined interface that you can use in your apps. It comes in two flavors: a static library and a dynamic framework.
Start your archiveNavigate to your project's settings. Under iOS (or the target you want to build your app for) > Identity, you'll want to increment the Build number. For example, if the Build number was 1, you'll want to set it to 2. Then, in the top menu, under Product, click on Archive.
Since you are bundling the framework with your app, you should set the framework's install location. You can set that in your framework target build setting "installation location". Use something like:
@executable_path
You could also use a separate folder for your frameworks, then you would use:
@executable_path/../Frameworks/
In case you can't rebuild the framework (which is not yours, but I am saying in general), you can modify a prebuilt framework installation path like this:
install_name_tool -id @executable_path/../Frameworks/<framework_name> <your_framework>
Here you can find a reference for this.
If you are going to bundle a framework inside another framework, you can use @loader_path
instead of @executable_path
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With