set the Embedded Content Contains Swift Code (EMBEDDED_CONTENT_CONTAINS_SWIFT) build setting to YES in your app as shown in Figure 2. This build setting, which specifies whether a target's product has embedded content with Swift code, tells Xcode to embed Swift standard libraries in your app when set to YES.

Worked for me too, so thanks a bunch. What puzzles me is, if I add swift code to a project, why doesn't Xcode updates this automatically? It sounds like a reasonable default behavior. I suppose this way it gives you more control over included libraries, etc.
– PoL0Dec 3 '14 at 12:06

Clean makes sense, since it forces refreshing of cached items used in a build. I had to do this because I just refreshed a signing certificate. I did a clean and a Clean Build Folder (Option-clean).
– Victor EngelMar 13 '16 at 17:03

10

ha yes,it worked. i had reset my certificates earlier and this clean worked like a charm.
– Code TreeMay 7 '16 at 14:26

GENIUS, hah this was prob caused by upgrading from swift 2 to 3 without cleaning in between i suspect, for me at least
– FonixNov 10 '16 at 13:33

If error occurs when compiling on a different machine, this could be the easiest fix.
– cyparkJan 31 '18 at 16:45

Again, answer quite vague. Not entirely sure what that means in relation to the OP.
– Richie MarquezNov 12 '14 at 18:46

2

Worked for me. Adding only to the "Linked frameworks and libraries" section didn't do the trick.
– DanchoysMar 14 '15 at 15:57

5

To expound: If what you're seeing in the error message is the name of a framework (e.g., a custom Cocoa Touch Framework that you made), don't just add the .framework in the Target Dependencies in Build Phases. You also need to add it to Embedded Binaries in the General tab. This answer fixed it for me.
– Matthew QuirosApr 15 '15 at 9:29

Worked for me only when deleting and creating only in XCode, developer.apple.com's "Certificates, Identifiers & Profiles" tool created new bad certs.
– Graham P HeathDec 15 '14 at 19:00

4

Forgive my ignorance... What does this Answer have to do with the Question that was asked? It looks like you answered a different question. Or more correctly, you responded to @user3056783 deleted answer which was just an "I'm having this problem too comment".
– jwwApr 15 '15 at 9:36

I had just generated a certificate in Xcode, so it may have been the same issue, though I was able to resolve it by just running a Clean.
– pr1001Apr 4 '16 at 18:12

It worked for me as well. I was using pods to include PubNub and AWS sdks. I have tried using different methods like changing 'Runpath Search Paths' It was already set to value mentioned in above answer. Marked yes to Embed swift code in build settings but did not work. Finally this solution worked for me. Cheers.
– EhsanJun 30 '16 at 0:15

1

Worked for me. I would never have suspected something like this. Thanks a lot.
– Pierre-YvesAug 26 '16 at 8:55

I tried every solution above this and this was the nail in the coffin. I'm not sure if I needed a combination of all of them, but this was the winner for me. To be clear, the ones I did were: Cleaning the proj, include load_path in Runpath search paths, moved distribution cert from system to login keychain, set Always embed swift standard libraries to yes, "untrusted" the cert (set it back to system default trust).
– Nick MolyneuxNov 15 '16 at 18:24

I was having this issue with running my Swift tests (but not my app). It turns out that the test needed to have more than @executable_path/Frameworks in it's Runpath Search Paths build setting for the test target. Setting the Runpath Search Paths to the following worked a charm for me:

Yep this is it! Faced this for AFDateHelper.framework, Result.framework for those that Google their way here. I realised this was the solution since doing this changed the name of the framework I was receiving this error for - that was a framework I'd missed out on including in carthage copy-frameworks since it was a secondary dependency (one that a framework I was using had added)
– AngadJun 23 '16 at 14:28

Q: What can I do about the libswiftCore.dylib loading error in my
device's console that happens when I try to run my Swift language app?

A: To correct this problem, you will need to sign your app using code
signing certificates with the Subject Organizational Unit (OU) set to
your Team ID. 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.

Usually this error appears in the device's console log with a message
similar to one of the following:

The new certificates are needed when building an archive and packaging
your app. Even if you have one of the new certificates, just resigning
an existing swift app archive won’t work. If it was built with a
pre-iOS 8 certificate, you will need to build another archive.

Important: Please use caution if you need to revoke and setup up a new
Enterprise Distribution certificate. If you are an in-house Enterprise
developer you will need to be careful that you do not revoke a
distribution certificate that was used to sign an app any one of your
Enterprise employees is still using as any apps that were signed with
that enterprise distribution certificate will stop working
immediately. The above only applies to Enterprise Distribution
certificates. Development certs are safe to revoke for
enterprise/standard iOS developers.

As the AirSign guys state the problem roots from the missing OU attribute in the subject field of the In-House certificate.

I have an enterprise development certificate, creating a new one solved the issue.

After spending many many hours trying to understand why my new CI setup was not able to properly publish a beta app (enterprise account, indeed), I figured out that in the export options, compileBitcode MUST be true.
– gderacoNov 20 '17 at 18:33

I made a command line tool that uses some dylibs that are to be delivered along with the tool in a local directory (and not in /usr/lib or something like that). otool -L for these dylibs told me that they were already using @rpath/... for their own path. Now, by setting the Runpath Search Path to the path of that folder, I can run my tool and it'll find the dylibs that are stored in a folder next to it.
– Thomas TempelmannMar 24 '17 at 22:00

When trying to add a Swift module into a React Native project, it was instead failing to find @rpath/libswiftAppKit.dylib. An issue lead me to learn that I had to add the searchpath: @executable_path/../Frameworks/ based on these instructions. Whether this applies only to my project structure, I can't say. Of note, I did not have to clean DerivedData for this setting to take effect!
– Jamie BirchMay 19 '18 at 11:02

After having tried out everything, I finally found out, that the build seems not always include every detail again and again. Maybe for speeding up the process...
In order to ensure WHOLE packaging before running on a device, make a Clean first: Shift-Cmd-K.
Then build with: Cmd-B.
After that run it on your device.
Easy.
Kind regards to all you nice guys in that place!

I renamed it like this : MyApp.something and the same issue appeared.
But I saw in the build Settings window, my product module name has been changed like this MyApp-something.
So, I removed the dot in my target name (MyAppSomething) and the issue was gone.

none of these solutions seemed to work but when I changed the permission of the world Wide Developer cert to Use System defaults then it worked. I have included the steps and screenshots in the link below

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Bartłomiej SemańczykDec 30 '15 at 8:33

There are lot's of answers there but might be my answer will help some one.

I am having same issue, My app works fine on Simulator but on Device got crashed as I Lunches app and gives error as above. I have tried all answers and solutions . In My Case , My Project I am having multiple targets .I have created duplicate target B from target A. Target B works fine while target A got crashed. I am using different Image assets for each target. After searching and doing google I have found something which might help to someone.

App stop crashing when I change name of Launch images assets for both apps . e.g Target A Launch Image asset name LaunchImage A . Target B Lunch Image asset name LaunchImage B and assigned properly in General Tab of each target . My Apps works fine.

This happened to me, going from Xcode 9.2 to 9.3. Though I didn’t discover it until long after the upgrade, because as long as the project has been built using Xcode 9.2 previously, it continues to work indefinitely with Xcode 9.3. Only after doing a clean checkout did I discover this.
– Svein FidjestølMay 14 '18 at 7:45

I have multiple version of Xcode installed at the same time. The framework was built with a newer version of Xcode. The app that I tried to compile was with an older version of Xcode. When I cleaned and compiled both the framework and the app with the same version of Xcode then things worked.

To add on to the Enterprise distribution cert solution: you can open Keychain and inspect the cert. If there is any red text saying the trust chain can't be verified or it being revoked, it WILL NOT WORK! On my computer, our distribution cert was showing as revoked even though the web portal showed it as still valid. We got a new distribution cert, which was green (valid) in Keychain, and this solved the issue.

When Xcode asks you to reset certs, you reset it. And the app can be run on actual device without crash with that error messages. Once this problem is fixed in one swift project. Other swift projects with this problem are fixed also.

I have struggled for these about half a day and I found that reset certs again and again in provisioning portal doesn't help.

In my case, one of my testing targets was working but the other one was not. It was giving the above error with a missing library or whatever. I compared the settings for both of the testing targets and found that one was missing the configuration for "Test Host", so I copied that from the working test target and it fixed my broken test target!

Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).