6

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.

Kohlbrr
  • 3,861
  • 1
  • 21
  • 24
user4321945
  • 93
  • 2
  • 9
  • Please file a bug with Apple or even take out a support incident. A lot of people are having the same problem recently. Something has gone wrong with Swift. – matt Dec 03 '14 at 21:48
  • Exactly what kind of device is your "other team member" able to run on? – matt Dec 03 '14 at 21:49
  • The other team member is using an iPhone running iOS 8.1.1. I think it is something to do with the build environment because the app built on this other team members xcode (same version as mine) works fine on my device. – user4321945 Dec 03 '14 at 23:35
  • I said "exactly". There's no such thing as "an iPhone". _What kind of iPhone?_ This could be important. We know you have an iPhone 5. Now we want to know what he has. Please find out. – matt Dec 04 '14 at 00:57
  • 1
    It has nothing to do with "the build environment". I was building Swift apps and running them on my device just fine for months - and then I wasn't. I changed nothing. It's Swift that changed. Now we need to figure out how. – matt Dec 04 '14 at 00:59
  • I am having same problem as of about ten days ago. Have been on vacation since and haven't got back to it. Thought it was just me... – Mike Taverne Dec 04 '14 at 03:33
  • @Matt - the other person who is able to build and deploy to all our devices is using an iphone 5s. When I build the same app on my Mac and attempt to deploy it to my device, it fails. – user4321945 Dec 04 '14 at 19:50
  • Exactly what I suspected. So I'm betting that this is a 32-bit vs. 64-bit device problem. Something has gone wrong with Swift so that you can't develop on a 32-bit device. Thanks for confirming that! – matt Dec 04 '14 at 19:51
  • Oh, and that may give us a workaround; you might be able to develop on your device by suppressing the 64-bit architecture in your build settings. In other words, if the only architecture is the 32-bit architecture, it might solve the problem. It's not a real solution, just a workaround; obviously you wouldn't want to suppress 64-bitness in real life. – matt Dec 04 '14 at 19:52
  • @MikeTaverne What's your device type? – matt Dec 04 '14 at 19:55
  • @matt - iPhone 6 Plus. But my coworker can run the same app on my phone. And I cannot run the app on iPhone 6. My device used to work up until two weeks ago. At that time I had some issues with my developer certificate and provisioning profile, after which the problem appears to have started. The app starts on my device now - I see the startup screen - then is crashes with the error described above. I suspect a problem with my cert still. It seems like a personal problem :) – Mike Taverne Dec 04 '14 at 20:52
  • But the app runs fine on iPod 5th gen with iOS 7.0.6. Argh. – Mike Taverne Dec 04 '14 at 22:02
  • @Matt - here is what Apple Dev support has to say about this problem "Our engineers have reviewed your request and have determined that you are experiencing an issue for which there is no known workaround at this time." :-( – user4321945 Dec 04 '14 at 22:03
  • @MikeTaverne So much for the bitness theory. - Here's the thing. The ability to develop on the device is exactly what you're paying $99/year for. If you just wanted to develop on the simulator, that's free. So if you can't develop on the device and you're paying to be able to do so, Apple are in breach of contract. They _must_ solve this and we need to make that very clear to them. – matt Dec 04 '14 at 22:43
  • @matt What is the best way to raise the issue with Apple? I have not done this before. Do you have any sense for how widespread this issue is? Thanks. – Mike Taverne Dec 04 '14 at 22:54
  • @MikeTaverne It's plastered all over Apple's dev forums, that's for sure. And do a search right here for the key parts of the error message. Look at the "Related" links to the right of this comment, for one! I guess the way to start is to raise it as a dev support incident and don't be satisfied with the answer "no known workaround". They _must_ provide a solution. – matt Dec 04 '14 at 23:46
  • Opened a support ticket, will see what happens. – Mike Taverne Dec 05 '14 at 02:11
  • "Our engineers have reviewed your request and have determined that you are experiencing an issue for which there is no known workaround at this time." – Mike Taverne Dec 05 '14 at 20:56
  • @MikeTaverne Right, that's what they told the OP as well. But they can't leave it at that. This is not just "an issue" - it is a complete breach of contract. You have paid for a dev membership. A dev membership where you can't develop on a device is no membership at all, since if all you wanted is to develop on the simulator, you could do that for free. They have to give you satisfaction here. – matt Dec 07 '14 at 02:45
  • @MikeTaverne Okay, I've had good luck with David Berger's solution. I had to delete and install so many things along the way that it's hard to know where to pin the solution, but it is true that after deleting all certificates (including cleaning them out from my keychain) and all profiles for apps not actually in the app store (which the Member Center wouldn't let me delete), and starting from scratch, we're back in business. – matt Dec 07 '14 at 19:54
  • @matt - Yep, this worked for me too. I re-created my developer cert and it works now. Wish Apple could have told me this. :( Thanks for your help. Mike – Mike Taverne Dec 08 '14 at 19:26
  • @MikeTaverne You were a big help too. And so was David Berger. I hope we've also helped the OP! – matt Dec 08 '14 at 19:50
  • possible duplicate of [dyld: Library not loaded: @rpath/libswiftCore.dylib](http://stackoverflow.com/questions/26024100/dyld-library-not-loaded-rpath-libswiftcore-dylib) – Shai May 11 '15 at 11:31

3 Answers3

5

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.

David Berger
  • 766
  • 5
  • 10
  • If this were a certificate problem then (1) why doesn't Apple tell people that if that's the solution? and (2) how do you explain the fact that we can all run on a device just fine if the app is Objective-C only? This is not a certificate problem, it's a _Swift framework_ problem. – matt Dec 07 '14 at 18:21
  • You making a small point over a semantic issus. Apple changed their certificates without telling anyone. Apple designed their certificates and designed the Swift framework in a way so that they are coupled. The Swfit launching procedure on an iOS device looks for information that was embedded in the cert. If it is not there it crashes. To me this is a problem with both. – David Berger Dec 07 '14 at 18:30
  • That's a good argument... I'm up and running again, and starting from a completely fresh cert and provisioning profile was one of the things I did along the way, so I'm upticking your answer even if I can't be sure that _post hoc_ was _propter hoc_. :) – matt Dec 07 '14 at 19:51
  • @DavidBerger - upvote for this! In my case, re-creating my developer cert fixed the issue. When I ran my app in Xcode after downloading the new cert, it prompted me that my provisioning profile did not include my new cert, and offered to "Fix Issue". I clicked that and it generated a new provisioning profile and I was good to go. Mike – Mike Taverne Dec 08 '14 at 19:28
  • I did this step several times and it has not solved my issue. – Eastern Monk Mar 30 '15 at 08:25
1

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.

Vijay V S
  • 139
  • 6
0

I had the same problem after updating XCode, with an "old" Swift Project...

I solved it by creating a new project with the new XCode and just copy / paste my old classes to it... If you copy / paste every class/storyboard to the new project it will run

Dennis Weidmann
  • 1,942
  • 1
  • 14
  • 16