6

Update 2: This is an old question involving the developer beta of iOS 8 and Xcode. The problem was that the Swift standard library wasn't included in the iPhone 4s iOS 8 beta. The issue has been resolved in the release.

Update: I've been getting fed up with the errors and crashes that come along with beta software, so I decided to reset my phone to iOS 7.1.1 and now the error is gone... I have no idea what is going on, but I'm going to assume its a bug since iOS 8 is still in beta. I will file a bug report with Apple and hope it gets resolved with the next seed.


As many other people before me, I am receiving the following error message when running a swift-based app on my iPhone (4S running iOS 8.0 beta 1):

dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib
Referenced from: /private/var/mobile/Containers/Bundle/Application/
CDC7263B-9F18-4369-87CC-F36DB5163B99/TESTPROJECT.app/TESTPROJECT
Reason: no suitable image found.  Did find:
/private/var/mobile/Containers/Bundle/Application/
CDC7263B-9F18-4369-87CC-F36DB5163B99/TESTPROJECT.app/Frameworks/
libswift_stdlib_core.dylib: mmap() error 1 at address=0x00206000, 
size=0x00128000 segment=__TEXT in Segment::map() mapping 
/private/var/mobile/Containers/Bundle/Application/
CDC7263B-9F18-4369-87CC-F36DB5163B99/TESTPROJECT.app/Frameworks/
libswift_stdlib_core.dylib

When running on the iOS simulator (iPhone 4S), I get the following (many times):

SetAppThreadPriority: setpriority failed with error 45

- This is a new single view application project generated from the built-in templates with Xcode 6 beta, with none of my own code. (Also happens with an empty application) - I have already tried the solution found here (restarting Xcode)

I can't seem to find any other way of moving/accessing the required swift library.

Community
  • 1
  • 1
David Skrundz
  • 13,067
  • 6
  • 42
  • 66

7 Answers7

5

For me, quitting and relaunching Xcode made this go away.

Poulsbo
  • 648
  • 5
  • 18
5

I ran into the same problem and I think it maybe because the app has to be configured to dynamically load certain frameworks. In any case changing the "Runpath Search Paths" build setting to "@executable_path/Frameworks" seemed to fix the problem.

I'm guessing that Xcode sets this automatically for new projects but older projects may need to be fixed manually. In my older project it was blank.

Miles Egan
  • 51
  • 1
  • 3
  • 1
    This fixed my problem, thanks. By the way it's "Runpath Search Paths", not "Runtime Search Paths". – ujell Jul 09 '14 at 14:03
  • And the "Runpath Search Paths" is in Project/Linking – Scott Jul 23 '14 at 15:20
  • I came to the same conclusion independently; see my answer here: http://stackoverflow.com/a/25247890/341994 – matt Aug 11 '14 at 16:21
3

I hit this problem in simulator. I tried some settings listed here http://ikevin.tw/?p=174.

In summary, Defines Module -> Yes, Embedded Content Contains Swift Code -> Yes, Product Module Name -> [My product name].

These changes managed to get me to launch and run.

The trick is that afterwards, I reverted the changes to see which of them actually made a difference. After reverting all of them, the app still launched. So it's completely unclear what actually caused the app to end up launching.

JerryH
  • 111
  • 1
  • 2
2

I'm guessing your iPhone 4S is lower than iOS 6. We also did regression tests on iPhone 4S's on iOS 6 and 7 but they were all fine. Devices on iOS 5 and 5.1 had the same error as you have though.

John Estropia
  • 17,460
  • 4
  • 46
  • 50
  • My phone is running iOS 8.0 beta 1 – David Skrundz Jun 09 '14 at 06:37
  • 1
    This is the closest answer to the solution I found. The issue was with the OS that was installed on my phone. Downgrading back to iOS 7 fixed the issue, which tells me that the current beta isn't working properly (big surprise...) – David Skrundz Jun 15 '14 at 04:40
2

I had this issue using an Ad Hoc (or enterprise) mobileprovision with a production certificate. Switching to a development certificate and mobileprovision solved the issue.

MacTeo
  • 2,656
  • 1
  • 20
  • 23
  • 1
    This is the root cause. Swift apps need libswift_stdlib_core.dylib. On all iOS 8 Betas so far (1 through 5), the device refuses to load dylibs that are signed with a distribution identity. The only workaround I've heard of is to use a developer identity (and matching provisioning profile). – Bob Whiteman Aug 08 '14 at 22:51
  • The fix is to re-generate your Production Cert, just done it now and it worked. – orta Sep 30 '14 at 09:26
-1

99% of the time when you get an error like this when upgrading the beta, it's the cache in ~/Library/Caches/com.apple.dt.Xcode* directories. Delete these and rebuild.

meelawsh
  • 617
  • 6
  • 8
-1

I had the same issue on an exploratory project. When I tried to build on a device I got the error. All I had to do was set the 'Provisioning Profile' in 'Code Signing' and everything worked. enter image description here

Kris Utter
  • 129
  • 2
  • 5