Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift app crashes when run on device - dyld: Library not loaded: @rpath/libswiftCore.dylib

I am a newbie to the ios/xcode world and attempting to test out a simple Swift app on my iphone 5 running iOS v8.0.2. The app builds successfully in xcode (Version 6.1 (6A1052d)) but when it attempts to run it on the iphone, it crashes with the following error:

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /private/var/mobile/Containers/Bundle/Application/FBBDB6F3-6B2C-428F-AA9C-E88FE439D5B6/prox.app/prox
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/FBBDB6F3-6B2C-428F-AA9C-E88FE439D5B6/prox.app/Frameworks/libswiftCore.dylib: mmap() error 1 at address=0x001FA000, size=0x001A0000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/FBBDB6F3-6B2C-428F-AA9C-E88FE439D5B6/prox.app/Frameworks/libswiftCore.dylib
    /private/var/mobile/Containers/Bundle/Application/FBBDB6F3-6B2C-428F-AA9C-E88FE439D5B6/prox.app/Frameworks/libswiftCore.dylib: mmap() error 1 at address=0x004DA000, size=0x001A0000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/FBBDB6F3-6B2C-428F-AA9C-E88FE439D5B6/prox.app/Frameworks/libswiftCore.dylib
(lldb) 

I have tried out most of the suggestions that have helped others who have run into this error but have had no luck getting around it. The same app works fine when built using the build environment of another team member. I have compared the build settings and found them to be identical.

like image 618
user4321945 Avatar asked Dec 03 '14 21:12

user4321945


2 Answers

Try creating a new distribution cert and a new provisioning profile. It is possibly related to this. I ran into this issue.

https://www.airsignapp.com/ios-apps-using-swift-crash-when-signed-with-inhouse-certificate/

Basically Apple added a new field to the cert and did not tell us in any clear way.

like image 74
David Berger Avatar answered Nov 14 '22 22:11

David Berger


You probably need to use a new certificate for signing your application. Excerpt from the Apple technical FAQs.

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.

  • Reference: https://developer.apple.com/library/ios/qa/qa1886/_index.html
like image 38
Vijay V S Avatar answered Nov 14 '22 22:11

Vijay V S