I get this error after adding a Swift class to an old Xcode project.
dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib
How can I make the project run again?
This error can occur if something went wrong during the conversion of an Objective-C project to start using Swift. The issue is that the Linker build settings never got configured properly, so you'll have to do it by hand. Look for the Runpath Search Paths build setting and set it to:
$(inherited) @executable_path/Frameworks

EDIT: I should also add that there has been recent spate of these errors caused by something else entirely - Apple made a change in Swift itself, starting in perhaps Xcode 6.1 or 6.1.1. The only solution seems to be to quit Xcode, destroy your certificates in Keychain Access, go to the Member Center and delete all certificates and profiles (except the profiles for apps in the Store - you can't delete them), and then start the entire certificate request process from scratch.
I searched long on this issue. There are several reasons causes this issue.
If you are facing when you and Swift code/library in an Objectice C project you should try Solution 1-2-3
If you are facing this issue with a new a Swift project Solution 4 will fit you best.
Restart Xcode, then computer and iPhone
Go to project build settings and set Always Embed Swift Standard Libraries (previously Embedded Content Contains Swift Code) flag to YES
Go to project build settings and add @executable_path/Frameworks to Runpath Search Paths option
If none of above works, this should. Apple seems to be ninja patched certificates as mentioned in AirSign's post
At InHouse certificates
Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, O=Company Name, C=FR
they added a new field named OU
Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR
so you should just recreate certificate and provision
For developers who have had this issue with a Adhoc/Enterprise distribution builds,
Create the production certificate from dev portal and then regenerate the distribution profile. Download and install both of them on your Mac. Ensure you selected the right profile in your Xcode build settings and rebuild your app.
Solution 5:
In my case, all solutions mentioned in the answer of accfews were very helpful but none has worked. I solved my problem by adding my swift library in the section "Embedded Binaries" in the "General" section of my Project's target. Perhaps is this due to the fact that I have included my swift framework in my workspace? Whatever it compiles now! Get ready Swift, I'm here!
For me, the issue was due to the fact that my Apple Worldwide Developer Relations Certification Authority was invalid.
Download it from here: https://developer.apple.com/certificationauthority/AppleWWDRCA.cer
Drag and drop it into Keychain Access, clean the project, and run.
I had an Obj-C project where I started adding swift source files. The following fixed the issue for me:
RUNPATH SEARCH PATHS = $(inherited) @executable_path/FrameworksEMBEDDED CONTENT CONTAINS SWIFT = YESI just created a new project from the templates Xcode 6.3 and compared the project settings with my old original project.
The reasons for this occurring are many. Having just spent a fun weekend finding yet another issue that causes this (the order of code signing), I wanted to create a summary answer that brings all the possible solutions together:
DerivedData and Build directories. Look under the Preferences for the location of DerivedData. Build should be in your project folder.@executable_path/Frameworks. That's the easy stuff. If you are doing your own command line build you may be creating your own .ipa files to upload. In that case you need to ensure the following:
SwiftSupport/iphoneos is the same as the version in Contents/YourApp.app/Frameworks Because Swift is not yet binary compatible between version, you must ensure these versions are the one that you built your app with. You can find these libraries under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos.codesign the libraries and framework files (under Frameworks in the .app folder) first and then sign the entire .app tree. The .app tree must be signed with an entitlements.plist but not the frameworks.Hopefully when Swift 3.0 comes out and we no longer need to bundle Swift with our apps this whole issue will go away.
My project is a Swift project with some Objective-C classes. I had the same problem when signed with old inHouse (enterprise) certificate.
The following steps fixed this for me.
Runpath Search Paths build setting to: $(inherited) @executable_path/Frameworks.I have faced the same issue, setting the right code sign identity solved the problem(Build settings->Code Signing Identity).
As per Apple technical question "All Enterprise and standard iOS developer certificates that are created after iOS 8 was released have the new Team ID field in the proper place to allow Swift language apps to run"
I got the same issue using Mavericks, Xcode 6.1.1, testing on an iPhone5 with iOS 8.1.1. I tried all possible solution including new certificates and provisioning profiles, but nothing helped. I did the changes to Embedded Content Contains Swift Code and Runpath Search Paths both on Project level and Target level.
I have now installed Yosemite, and without any further changes, it started to work.
otool- Jim Hayes