dyld: Library not loaded: #rpath with iOS8 - ios

I'm creating an iOS framework with Xcode6 and iOS8. When I link this with an iOS app and try running it on the device I get this error
dyld: Library not loaded: #rpath/FrameworkName.framework/FrameworkName
Referenced from: /private/var/mobile/Containers/Bundle/Application/0F2C2461-A68B-4ABA-A604-B88E6E9D1BB1/AppName.app/AppName
Reason: image not found
The 'Runpath Search Paths' build setting for the framework is set by default to
'#executable_path/Frameworks', '#loader_path/Frameworks'
I could not find any documentation related to this. This was something new introduced with Xcode6 and I would expect it to just work by simply including the framework into any app that needs it.

To make this work
In the framework project settings change the install directory from
'/Library/Frameworks' to '#executable_path/../Frameworks'
In the project that includes this framework, add a copy files phase and copy this framework to the 'Frameworks' folder. Once you do this ensure that this framework is listed under the 'Embedded Binaries' section.

Issue resolved using this answer. According to #vladof81:
In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.
Reference is here on Apple Developer Forums.

I also had same kind of problem where I was not able to launch the app & app was crashing with above message :
dyld: Library not loaded: #rpath/FrameworkName.framework/FrameworkName Referenced from: /private/var/mobile/Containers/Bundle/Application/xxxxxxxxxxxxxxxxxxx
Reason: image not found
Here is my approach that helped me to resolve this error:
From General Tab
Frameworks, Libraries, and Embedded Content
add the framework and make sure to make it Embed & Sign
From Build Phases
Dependences
add the framework to it

Check if you can find framework in context under :
Build Phases > Embed Frameworks >
If not just add that framework in "Embed Frameworks" after adding that framework in your project directory's "Frameworks" section.

I was getting this error on a library installed through CocoaPods. Cleaning the build folder (cmd + option + shift + k) and then doing a clean (cmd + shift + k) was what ended up resolving this issue for me.

If you are using Carthage
Run carthage update on terminal
Go to Project Settings -> Build Phases -> Carthage Copy Frameworks
Add line in Inputs files:
$(SRCROOT)/Carthage/Build/iOS/YOURLIBRARY.framework
Add this line to Output files:
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/YOURLIBRARY.framework

For me it was because of the SSL issue, I had set my developer, distribution certificates on my Mac(Keychain) to 'Always Trust' for one of my other project. I had to change them back to 'Use System Defaults'. it was working for me then!!

Made the library which shows not loaded changed from required to optional in Linked binaries and frameworks. It is working perfectly now

I also had same kind of problem where I was not able to launch the app & app was crashing with above message :
dyld: Library not loaded: #rpath/FrameworkName.framework/FrameworkName
Referenced from: /private/var/mobile/Containers/Bundle/Application/xxxxxxxxxxxxxxxxxxx
Reason: image not found
Here is my approach that helped me to resolve this error:
1.Please delete your app from device, Clean the build and and rebuild and run on the device.
2.If above steps does not help you, then please check for below settings :
From "TARGET">"Build Settings">"Runpath Search Paths" & then check for values "$(inherited)" & "#executable_path/Frameworks", Feel free to add incase they don't exist.
Build your app and run it on device

In addition to the above solutions, recheck the paths of frameworks included in your application under
Build Settings --> Search Paths --> Framework Search Paths

When non of those solution works:
(Optional) Get a clear knowledge from here on different search path type
Make sure that your .framework file paths are added in Build Settings -> Framework Search Paths. You can keep all framework files somewhere in App/libs/ and add this folder and enable recursively.
Make sure that your .a files paths are added in Build Settings -> Library Search Paths.

I installed third party libraries using Cocoapods. Got the same error, tried everything but finally realised I havent had use_frameworks! in my pod file.
So removed the currently installed library, added use_frameworks! line in pod file, reinstalled the libraries and all worked for me.

The way tested by me is well.
In "Linked Binary With Libraries" change the missing framework to "Embedded Framework".
Because, "Do not Embedded" do not copy to the App, but Embedded Framework will copy into it.

Related

Load custom dynamic library(.dylib) in iOS application

I have created one custom library called 'Library.dylib',now I am trying to add that dylib file in another iOS project and it is giving following error,
dyld: Library not loaded: #executable_path/Library.dylib Referenced
from:
/Users/xxxx/Library/Developer/CoreSimulator/Devices/4CCFE5F7-494B-41DE-AEB9-5040418518B4/data/Containers/Bundle/Application/A97A1947-80B5-9AA0-B46F-C11E25A94553/DyLibTest.app/DyLibTest
Reason: image not found
In Mac app if we copy it in /usr/lib/ path it is working, but not in iOS app.
Please let me know how to use custom dylib in iOS application?
FYI I want to use only dynamic linking not static linking(.a)
As far as I can see your app expects your library to be copied to #executable_path/Library.dylib. Yet, if you add your library to the Embed Frameworks build phase (which I assume you did) it will be copied to the Frameworks subfolder in your app bundle and therefore cannot be loaded by your app.
There are two solutions:
1) Change the destination of the Embed Frameworks build phase from Frameworks to Executables. In general, I wouldn't recommend to change that though.
2) Adjust the Runpath Search Paths in your build settings to include #executable_path/Frameworks.
Hope that helps.
You must put *.dylib file in Embed Libraries.
Project -> Build Phases -> Embed Libraries
Click to "+" and choose your *.dylib file.

Library not loaded- Alamofire

I have been plagued by a bug for hours. I am building a framework using Alamofire and am testing it in an iOS project. Whenever I run the project, I get this error:
dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire
Referenced from: /Users/theodorestrauss/Library/Developer/Xcode/DerivedData/TGClient-ecnnvvvxipoufihfghkpxlfccyoc/Build/Products/Debug-iphonesimulator/TGClient.framework/TGClient
Reason: image not found
I have scoured the web looking at GitHub issues, Stack articles, and more. I've cleaned, deleted Derived Data, added and deleted frameworks from embedded binaries, etc.
For anyone out there, this is not a duplicate. All other questions and answers are outdated.
If anyone can help, I'd immensely appreciate it. Thanks so much in advance. Cheers,
Theo
Make sure your build settings > Runpath search paths have be
• #executable_path/Frameworks
• $(inherited)
Also in your framework search path below entry is there
"$PODS_CONFIGURATION_BUILD_DIR/Alamofire"
This is what I do when I have this problem (and it really works!):
Remove Alamofire framework from target/embedded libraries and target/linked frameworks and libraries by highlighting it and clicking the minus sign. (click on your project name in the upper left corner if you don't see these areas in the center of your screen).
Perform a product clean (Shift-Cmd-K).
In Embedded Binaries section, click on the + sign. Add Alamofire. (or drag the Alamofire icon from the left column into this section and drop it there)
Xcode should fix everything, and it should now load onto the device properly.
I was getting this error while using Alamofire 4.5 + carthage, I added the framework as Linked Libraries in the build phase, the app was crashing on start. In XCode 9.1 I couldn't find the option of Embedded framework, so I added a Run Script to copy framework from Carthage and it started working.
So basically this
Add the framework to the build phases as you normally do.
Add the below Run Script
/usr/local/bin/carthage copy-frameworks
$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
Can you please clear derived data once and build the project again.
Here is how to clear derived data. Open the terminal and simply hit this command.
rm -rf ~/Library/Developer/Xcode/DerivedData
I solve it by unchecking run script only when installing in build phases menu

dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib

I've built a Swift framework and now I'm trying to start building a Swift iOS application that will use that framework. I'm getting this error:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: /Users/tdean/Library/Developer/Xcode/DerivedData/NFLApplication-ejmafvjrlqgjaabggwvadjarjjlg/Build/Products/Debug-iphonesimulator/NFLStatsModel.framework/NFLStatsModel
Reason: image not found
I've scoured SO and found similar reports and tried the fixes listed there, including:
Clearing out my DerivedData folder
Restarting Xcode and the iPhone simulator
Ensuring that Always Embed Swift Standard Libraries = YES is set, both in my framework and my application's build settings
Ensuring that Enable Bitcode=NO is set, both in my framework and my application's build settings
Ensuring that Runpath Search Paths is set to #executable_path/Frameworks, both in my framework and my application's build settings
Copied all the libswift files from my Xcode installation into a local copy within my project, and added a custom build phase to copy those files into the frameworks folder.
In every case, I get the same error when I try to run my application.
Xcode Version 8.1 (8B62)
Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
I eventually got this working using a mix of fixes. I'm not sure if all of them are needed, but I'm documenting what seemed to work for me here, just in case anyone else can benefit by what I've found.
I have set Always Embed Swift Standard Libraries to a value of YES in the build settings tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Linked Frameworks and Libraries section of the general tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Embedded Binaries section of the general tab for the Swift application that uses the framework.
With all 3 of these settings in place, I am able to build and run my application without encountering this error.
This might not be the case for everyone, but I solved it by actually writing some code in the main target.
I had an empty project consisting of a framework and a test target, and when running tests I was getting this error. Apparently Swift is pretty smart to detect that you don't actually need this library and does not link to libswiftSwiftOnoneSupport.dylib.
The fix is just to add some code, I just added:
class Test {
func a() { print ("something") }
}
and libswiftSwiftOnoneSupport.dylib got linked.
After several days of being stuck with this issue I finally found something that worked for me; hopefully this will help others too.
Turns out that specifically using print() anywhere in the code will somehow force libswiftSwiftOnoneSupport.dylib to be loaded and the issue will go away.
I'm using Xcode 10.1, Swift 4.2 and the pod that was giving me this issue was Nimble.
BTW, I am aware of #S2dent's suggestion to "just add some code" but in my case my framework already had several different classes so it didn't help me.
How are you installing your dependencies?
I had a similar issue:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: <internal framework>
Reason: image not found
It turned out to be related to Swift whole-module optimization.
Using Carthage as a dependency manager, they were being compiled for Release, and thus compiled with whole-module optimization, which Xcode suggested I turn on. Running the app on the simulator compiles it for Debug. I'm guessing that dynamic frameworks cannot be at a different level of optimization from the app running it.
The solution was to explicitly specify the configuration I wanted Carthage to build for. (carthage bootstrap --configuration Debug) Oh, and cleaning my build folder, of course.
I had the same issue, adding the library (my own build one) to Linked Frameworks and Libraries in General tab of the app solved the issue.
You can also provide an Host Application to your test target if you don't want to add Foundation.framework to Linked Frameworks or Embedded Binaries
You can solve this by setting "Always Embed Swift Standard Libraries" to "Yes" in the Build Settings of your target.
It is an dynamic linker error which links binary in load or runtime
[#rpath]

xcode 7.1 for iOS 9 missing libc++.dylib required for Objective C Realm Static Framework

I am following this doc for integrating realm in my iOS app.
Realm static framework for iOS
My problem is in step 3. I am unable to find libc++.dylib. I find a few other .tbd ones but none of them are libc++.
I followed a few other SO posts on using the "add other" option and doing command+shift+G and find that library but it's not in that list either.
Does anyone know any workarounds?
I had the same problem. I found some kind of way around.
Go to Build Phases > Link Binary with Librairies > + > Add other
Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
From /usr/lib you can add : libc++.dylib and more...
Compile and have fun
This is a known issue in the Xcode 7 beta.
To work around this issue for now, please:
Delete all references to .tbd files from either your linked libraries phase, or from the copied bundle resources phase (where they sometimes will be added).
Add the library you want to link manually to the "Other Linker Flags" build settings, by adding the argument:
-l<library_name>
for each library you want to link (for example, add "-lsqlite3" (without quotes)).
For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.
-- copy from link
finally, you can add -lc++ in this Other link Flags setting
I have same problem. I cannot find libc++.dylib through xcode but I found it using terminal.
You can copy or create a link to visible folder in xcode like /Users//Downloads.
Command below maybe help to fix the problem.
ln -s /usr/lib/libc++.dylib /Users/<your user>/Downloads/libc++.dylib
I had a similar issue with Realm the other week after the iOS 9 update. I know you already tried the method of going to build phases, add other, CMD + shift + G without success. However this was the method I used to locate libc++.dylib and I just checked it out again now and was able find it.
It is also worth mentioning that after you do manage to add libc++.dylib you may have build errors. In which case the fix I used was to go into your target's build settings and change Enable Bitcode to No.

iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

This crash has been a blocking issue I used the following steps to reproduce the issue:
Create a Cocoa Touch Framework project
Add a swift file and a class Dog
Build a framework for device
Create a Single View application in Swift
Import framework into app project
Instantiate swift class from the framework in ViewController
Build and run an app on the device
The app immediate crashed upon launching, here is console log:
dyld: Library not loaded: #rpath/FrameworkTest03.framework/FrameworkTest03
Referenced from: /var/mobile/Applications/FA6BAAC8-1AAD-49B4-8326-F30F66458CB6/FrameworkTest03App.app/FrameworkTest03App
Reason: image not found
I have tried to build on iOS 7.1 and 8.0 devices, they both have the same crash. However, I can build an app and run on the simulator fine. Also, I am aware that I can change the framework to form Required to Optional in Link Binary With Libraries, but it did not completely resolve the problem, the app crashed when I create an instance of Dog. The behavior is different on the device and simulator, I suspect that we can't distribute a framework for the device using a beta version of Xcode. Can anyone shed light on this?
In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.
Reference is here on Apple Developer Forums.
For iOS greater than or equal to 8
Under the target's General tab, in the Embedded Binaries section add the framework. This will copy the framework into the compiled so that it can be linked to at runtime.
Why is this happening? : because the framework you are linking to is compiled as a dynamically linked framework and thus is linked to at runtime.
** Note:** Embedding custom frameworks is only supported in iOS > 8 and thus an alternative solution that works on older versions of iOS follows.
For iOS less than 8
If you influence this framework (have access to the source code/build process) you may change this framework to be statically linked rather than dynamically linked. This will cause the code to be included in your compiled app rather than linked to at runtime and thus the framework will not have to be embedded.
** How:** Under the framework's Build Setting tab, in the Linking section, change the Mach-O Type to Static Library. You should now not need to include the framework under embedded binaries.
Including Assets: To include things such as images, audio, or xib/nib files I recommend creating a bundle (essentially a directory, more info here bit.ly/ios_bundle) and then load the assets from the bundle using NSBundle.
Just dragging the framework into your project isn't going to be good enough. That is like being in the same ballpark but not being able to find your kids. Follow these steps:
1) Create your framework
Develop your framework.
Once your development is complete, COMMAND+B build your framework and ensure you receive "Build Succeeded".
2) Access your framework
Once your framework project successfully builds it will then be ready for you to access in your Products folder in your project.
Right click on your .framework and select "Show in Finder".
3) Place framework in your project
Drag and drop the .framework from your Finder window to your app project's "Framework" folder.
4) Configure app project for framework
Select the top level in your project
Choose your target
Go to "Build Phases", then "Link Binary with Libraries", and ensure that your framework is included with optional selected.
Still in "Build Phases", go to the upper left and select the + button. In the drop down choose "New Copy Files Phase".
Scroll down to the new "Copy Files" section and ensure that you set Destination to "Frameworks". Leave the subpath empty. Then click the + button at the bottom left.
You will be presented with your project hierarchy. Scroll down to the "Frameworks" folder that you added the framework to in step 3, or search for it in the search bar at the top. Select your framework and click "Add".
Ensure that your framework is included with "Code Sign On Copy" selected.
5) Clean, then run your project
COMMAND+SHIFT+K
COMMAND+R
Firstly Try to build after Command+Option+Shift+K .If still fails then do below steps.
If anybody is facing this error in Xcode 8 then change your framework status to Optional instead of Required under the General Tab of your target.
I created a framework using Swift3/Xcode 8.1 and was consuming it in an Objective-C/Xcode 8.1 project. To fix this issue I had to enable Always Embed Swift Standard Libraries option under Build Options.
Have a look at this screenshot:
I had to (on top of what mentioned here) add the following line to Runpath Search Paths under Build Settings tab:
#executable_path/Frameworks
I got same kind of issue in iOS 9.x version
ISSUE IS: App crashes as soon as I open the app with below error.
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /var/containers/Bundle/Application/######/TestApp.app/TestApp
Reason: image not found
I have resolved this issue by changing Required to Optional in Linked Frameworks and Libraries for UserNotifications.framework framework.
You need to add the framework to a new Copy Files Build Phase to ensure that the framework is copied into the application bundle at runtime..
See How to add a 'Copy Files build phase' to my Target for more information.
Official Apple Docs: https://developer.apple.com/library/mac/recipes/xcode_help-project_editor/Articles/CreatingaCopyFilesBuildPhase.html
If you're using Xcode 11 or newer:
Navigate to the settings of your target and select General.
Scroll down to Frameworks, Libraries and Embedded Content.
Make sure the Embed & Sign or Embed Without Signing value is selected for the Embed option if necessary.
runtime error: dyld: Library not loaded: #rpath/<some_path>
It is a runtime error that is caused by Dynamic Linker
dyld: Library not loaded: #rpath/<some_path>
Referenced from: <some_path>
Reason: image not found
The error Library not loaded with #rpath indicates that Dynamic Linker cannot find the binary.
Check if the dynamic framework was added to the front target General -> Frameworks, Libraries, and Embedded Content (Embedded Binaries). It is very simple to drag-and-drop a framework to project with Copy items if needed[About] and miss to add the framework as implicit dependency in
Frameworks, Libraries, and Embedded Content(or check in Add to targets). In this case during compile time Xcode build it as success but when you run it you get runtime error
Check the #rpath setup between consumer(application) and producer(dynamic framework):
Dynamic framework:
Build Settings -> Dynamic Library Install Name
Application:
Build Settings -> Runpath Search Paths
Build Phases -> Embed Frameworks -> Destination, Subpath
Framework's Mach-O file[About] - Dynamic Library and Application's Frameworks, Libraries, and Embedded Content[About] - Do Not Embed.
Dynamic linker
Dynamic Library Install Name(LD_DYLIB_INSTALL_NAME) which is used by loadable bundle(Dynamic framework as a derivative) where dyld come into play
Dynamic Library Install Name - path to binary file(not .framework). Yes, they have the same name, but MyFramework.framework is a packaged bundle with MyFramework binary file and resources inside.
This path to directory can be absolute or relative(e.g. #executable_path, #loader_path, #rpath). Relative path is more preferable because it is changed together with an anchor that is useful when you distribute your bundle as a single directory
absolute path - Framework1 example
//Framework1 Dynamic Library Install Name
/some_path/Framework1.framework/subfolder1
Relative path allows you to define a path in a dynamic way.
#executable_path
#executable_path - relative to executable binary which loads framework
use case: Dynamic framework inside Application(application binary path
is #executable_path) or more complex example with App Extension[About] which is a part of Containing App with Dynamic Framework inside. There 2 #executable_path for Application target (application binary path is #executable_path) and for App Extension target(App Extension binary path is #executable_path)) - Framework2 example
//Application bundle(`.app` package) absolute path
/some_path/Application.аpp
//Application binary absolute path
/some_path/Application.аpp/subfolder1
//Framework2 binary absolute path
/some_path/Application.аpp/Frameworks/Framework2.framework/subfolder1
//Framework2 #executable_path == Application binary absolute path <-
/some_path/Application.аpp/subfolder1
//Framework2 Dynamic Library Install Name
#executable_path/../Frameworks/Framework2.framework/subfolder1
//Framework2 binary resolved absolute path by dyld
/some_path/Application.аpp/subfolder1/../Frameworks/Framework2.framework/subfolder1
/some_path/Application.аpp/Frameworks/Framework2.framework/subfolder1
#loader_path
#loader_path - relative to bundle which causes framework to be loaded. If it is an application than it will be the same as #executable_path
use case: framework with embedded framework - Framework3_1 with Framework3_2 inside
//Framework3_1 binary absolute path
/some_path/Application.аpp/Frameworks/Framework3_1.framework/subfolder1
//Framework3_2 binary absolute path
/some_path/Application.аpp/Frameworks/Framework3_1.framework/Frameworks/Framework3_2.framework/subfolder1
//Framework3_1 #executable_path == Application binary absolute path <-
/some_path/Application.аpp/subfolder1
//Framework3_1 #loader_path == Framework3_1 #executable_path <-
/some_path/Application.аpp/subfolder1
//Framework3_2 #executable_path == Application binary absolute path <-
/some_path/Application.аpp/subfolder1
//Framework3_2 #loader_path == Framework3_1 binary absolute path <-
/some_path/Application.аpp/Frameworks/Framework3_1.framework/subfolder1
//Framework3_2 Dynamic Library Install Name
#loader_path/../Frameworks/Framework3_2.framework/subfolder1
//Framework3_2 binary resolved absolute path by dyld
/some_path/Application.аpp/Frameworks/Framework3_1.framework/subfolder1/../Frameworks/Framework3_2.framework/subfolder1
/some_path/Application.аpp/Frameworks/Framework3_1.framework/Frameworks/Framework3_2.framework/subfolder1
#rpath - Runpath Search Path
Framework2 example
Previously we had to setup a Framework to work with dyld. It is not convenient because the same Framework can not be used with a different configurations. Since this setup is made on Framework target side it is not possible to configure the same framework for different consumers(applications)
#rpath is a compound concept that relies on outer(Application) and nested(Dynamic framework) parts:
Application:
Runpath Search Paths(LD_RUNPATH_SEARCH_PATHS) - #rpath - defines a list of templates which will be substituted with #rpath. Consumer uses #rpath word to point on this list
#executable_path/../Frameworks
Review Build Phases -> Embed Frameworks -> Destination, Subpath to be sure where exactly the embed framework is located
Dynamic Framework:
Dynamic Library Install Name(LD_DYLIB_INSTALL_NAME) - points that #rpath is used together with local bundle path to a binary
#rpath/Framework2.framework/subfolder1
//Application Runpath Search Paths
#executable_path/../Frameworks
//Framework2 Dynamic Library Install Name
#rpath/Framework2.framework/subfolder1
//Framework2 binary resolved absolute path by dyld
//Framework2 #rpath is replaced by each element of Application Runpath Search Paths
#executable_path/../Frameworks/Framework2.framework/subfolder1
/some_path/Application.аpp/Frameworks/Framework2.framework/subfolder1
*../ - go to the parent of the current directory
otool - object file displaying tool
//-L print shared libraries used
//Application otool -L
#rpath/Framework2.framework/subfolder1/Framework2
//Framework2 otool -L
#rpath/Framework2.framework/subfolder1/Framework2
//-l print the load commands
//Application otool -l
LC_LOAD_DYLIB
#rpath/Framework2.framework/subfolder1/Framework2
LC_RPATH
#executable_path/../Frameworks
//Framework2 otool -l
LC_ID_DYLIB
#rpath/Framework2.framework/subfolder1/Framework2
install_name_tool change dynamic shared library install names using -rpath
CocoaPods uses use_frameworks![About] to regulate a Dynamic Linker
[Vocabulary]
[Java ClassLoader]
Add the framework in Embedded Binaries
Then Clean and Build.
Surprisingly, not all of the necessary pieces are documented here, at least for Xcode 8.
My case was a custom-built framework as part of the same workspace. It turns out it was being built incorrectly. Based on jeremyhu's last response to this thread:
https://forums.developer.apple.com/thread/4687
I had to set Dynamic Library Install Name Base (DYLIB_INSTALL_NAME_BASE) under Build Settings of the Framework Project and then rebuild it. It was incorrectly set to $(LOCAL_LIBRARY_DIR) and I had to change it to #rpath.
So in the link processing stage in the App Project, it was instructing the host App to dynamically load the framework at runtime from /Library/Frameworks/fw.Framework/fw (as in, the root of the runtime filesystem) rather than path-to-App/Frameworks/fw.Framework/fw
Regarding all the other settings: it does have to be in 3 places in Build Phases, but these are all set at once when you just add it to the Embedded Binaries setting of the General tab of the hosting App.
I did not have to set up an extra Copy Files phase, which seems intuitively redundant with respect to the embedding stage anyway. By checking the tail end of the build transcript we can assure that that's not necessary.
PBXCp /Users/xyz/Library/Developer/Xcode/DerivedData/MyApp-cbcnqafhywqkjufwsvbzckecmjjs/Build/Products/Debug-iphoneos/MyFramework.framework
[Many verbose lines removed, but it's clear from the simplified transcript in the Xcode UI.]
I still have no idea why Xcode set the DYLIB_INSTALL_NAME_BASE value incorrectly on me.
Recently ran into this issue with importing CoreNFC on older iphones (e.g. iPhone 6) and Xcode (11.3.1). I was able to get it to work by
In your Projects, select the target.
Goto General tab on top.
Under the 'Frameworks, Libraries and Embedded Content' section, add the framework (for me it was CoreNFC). Repeat for other targets.
Click on Build Phases on top and expand 'Link Binary with Libraries'.
Make the troublesome framework optional (from required).
This allowed me to compile for older/newer iPhones without making any code changes. I hope this helps other.
My environment: Cocos2d 2.0, Box2d, Objective C
In addition to doing the other answers above I finally went to the General tab and made WatchKit Optional.
In my case the solution was to remove the compiled framework from the Embedded Binaries, which was a standalone project in the workspace, clean and rebuild it, and finally re-add to Embedded Binaries.
If you are using a third-party framework, and using Cocoapods as your dependency manager, try doing a pod install to refresh your pods.
This crash was occurring on a third-party library I was using, so glad the above solution worked for me, hope it works for you!
Resolved for me by unselecting "Copy only when installed" on Build Phases->Embed Frameworks
I had the same issue. I tried building my project with an iPhone that I never used before and I didn't add a new framework. For me, cleaning up worked fine (Shift+Command+K). Maybe it's because I use beta 5 of Xcode 7 and an iPhone 6 with iOS 9 Beta, but it worked.
For any project or Framework project in Xcode that use pods, one easy way to avoid dynamic library (dylb) not to load is to set you pod file to ink in static mode. To do so, just make sure to don't write the following line in your pod file.
use_frameworks!
Once the line deleted from your file which you saved, simply run form the console:
$ pod update
In my case, my project is written by objective-c and in the library there are Swift files. So I changed "Always Embed Swift Standard Libraries" in my project’s Build Settings tab to Yes and it became totally okay.
If have development pod Delete your app from simulator install from pod -> clean - > run again...
The same thing was when I've created a new Configuration and Build Scheme.
So the solution for me was to run
pod install
for this newly created Configuration.
For me, I had to switch the XcodeKit.framework from "Do Not Embed" -> "Embed & Sign"
After trying all the methods available on internet and my own trial and error tricks 100 times. Finally I was able to solve it. – Apeksha Sahu 6 mins ago
Goto iTunes in Mac --> accounts-->Authorize this computer – Apeksha Sahu 5 mins ago
second step.... Goto developer in settings in iPad and iPhone and reindex with identifiers and clear trust computers everything. It worked for me........ ....... After reinstalling Mac OSHigh seria 10.13.15 version from Mac OS seirra beta latest version, to reinstalling Xcode latest version, after updating all certificates. etc etc etc... as many methods as you can think I did. –
Try with changing flag ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES (in earlier xcode versions: Embedded Content Contains Swift Code) in the Build Settings from NO to YES.
Xcode 11
Navigate to settings of your target and select General.
Look for "Frameworks, Libraries, and Embedded Content"
Keep "Do Not Embed" and make sure that all your targets (if you have more than one) have only set it's own framework and not others targets.
In Xcode 11
I was facing the same issue
Changing "Do Not Embed" in General Tab > "Frameworks, Libraries, and Embedded Content" was still resulting the same error.
What did solved for me was adding the Framework in Build Phases Tab > Embed Frameworks section
--Updated---
I observed that in projects built in previous versions of Xcode Embed Frameworks Section is not available when running in Xcode 11, Find the below steps to achieve the solution:
1: First need to add the New Copy Files Phase under Build Phases tab.
2: Second change the name of the added phase to Embed Frameworks
3: Change the destination to Frameworks.
4: Add the framework for which the error occurred.
Although everyone is saying to embed the framework under the Embedded Binaries but still it is not working, because we are missing one important step here.
Here are the two right steps to add the binaries under Embedded Binaries tab :
Remove the framework which is giving the error from the "Linked Frameworks and Libraries" under the General tab.
Now add the removed framework only under the Embedded Binaries tab and that is all one would need to do.
Run it on the device and keep that smile ;)
For SumUp Users, if you are loading the latest SumUpSDK.xcFramework, then you need to make sure that it's set to "Embed & Sign" from the application's General tab of the Target.
i.e. to reverse the above statement (making it easier to understand):
Go to the "Project Navigator" (i.e. the first icon to show all project items etc)
Select your project from the top of the tree.
On the menu in the middle of the page (slightly to the right), select your application under "Targets"
From the top-tab, select "General"
Scroll down to "Frameworks, Libraries and Embedded Content"
Select your Lib from the list
Select "Embed & Sign" from the drop down list next to it.
Clean
Re-Build and run.
I hope this helps.
H
Go to file in xcode -> Workspace settings
Click the arrow next to which appears /Users/apple/Library/Developer/Xcode/DerivedData
Select the Derived data and move it to Trash.
Quite the xcode and reopen it.
Clean the project and run again.
Above steps resolved my issuses.

Resources