19

I have an application that uses HealthKit and Swift in it, everything compiles and runs fine when I test it from Xcode on a simulator or a device. I tested, debugged it, and submitted it to the iTunes store. When the application was approved I downloaded the new version from the store and it crashed right away. This was extremely puzzling as I have never had this issue before. I look at the diagnostic and usage logs on my phone and the crash report for the application says this:

Dyld Error Message: Library not loaded: @rpath/libswiftCore.dylib Reference from: /path/to/my/app Reason: no suitable image found. Did find: /path/to/my/app/Frameworks/libswiftCore.dylib: mmap() error 1 at address=0x100174000, size=0x0194000 segment=__TEXT in Segment::map()

Has anyone seen anything like this or know how to deal with it?

Thank you

EDIT:

The crashing issue magically fixed itself on the morning of October 4th, which tells me that this was an Apple issue. I have been emailing iTunes Connect Support, but they have not said one way or another what happened. I also opened a technical ticket without even a response back from Apple. This is pretty disappointing, not just for the fact that Apple is not being transparent about the issue, but also it makes me feel like I have no course of action later on down the road if this ever were to happen again.

AgnosticDev
  • 1,843
  • 2
  • 20
  • 36
  • 2
    I am experiencing a similar issue where my app is being rejected because of this same crash. According to App store review it is only happening on an iPad... I've tried to reproduce it with the exact same build on the exact same device they are experiencing the crash on with no luck. I've opened a support ticket and have had the ticket escalated, hopefully I will have an answer soon. I've tried many things and resubmissions, but it still crashes the same for the reviewer. – maxpower Oct 03 '14 at 18:38
  • @maxpower, thank you for the response. I opened a ticket with Apple also this morning. If I hear anything back I will update my post. Let me know if you hear anything back from Apple also. This is very frustrating. – AgnosticDev Oct 03 '14 at 19:16
  • 2
    I have the exact same issue. The same binary in release mode worked in TestFlight as well as with manual ipa install. I also submitted a ticket. – Ah Ryun Moon Oct 03 '14 at 19:51
  • OK, thanks for letting me know @Ah Ryun Moon. I am glad to hear I am not the only one having this issue. I will post an update here when I know more. – AgnosticDev Oct 03 '14 at 19:55
  • 1
    Just got the same exact issue, frustrating... – Daniel Oct 03 '14 at 20:37
  • How about the solution described here? http://stackoverflow.com/questions/25774085/xcode-gm-ios-8-gm-swift-today-extension-crash-in-simulator-and-device-library-n I had this set to NO, although my previous version worked fine, Might give it a try, but since i cant reproduce the issue, who knows... – Daniel Oct 03 '14 at 21:26
  • @Daniel I have combed through that thread. As a note to others: The Embedded flag is not for your own Swift code added to your project, it is when you are using frameworks or libraries that have swift and your project does not. This is a pretty unique case where you have tested on devices, even with your final build with ad hoc distribution and everything seems good. Once it hits App Review, it no longer works. They told me that it crashed on an iPad but not on an iPhone. Specifically an iPad Air which makes me think it is architecture based. It may be an Apple problem completely we will see. – maxpower Oct 03 '14 at 22:20
  • @maxpower from what i been reading in the apple forums it seems that it is an apple problem, but we will see – Daniel Oct 03 '14 at 22:34
  • Here is the apple dev forum on this issue https://devforums.apple.com/message/1054513#1054513 – Daniel Oct 03 '14 at 22:47
  • I was having the same issue and upgraded to Yosemite and that fixed it... as mentioned here: http://stackoverflow.com/questions/24333981/ios-app-with-framework-crashed-on-device-dyld-library-not-loaded-xcode-6-beta – covati Dec 05 '14 at 03:03
  • 1
    I have a similar issue with running my app on my iPhone...it works fine on the simulator, and then crashes immediately on the iPhone with basically the same message. This occurred soon after updating to XCode 7 and iOS 9 and adding a StackView to the storyboard. – Jeremy Kahn Sep 28 '15 at 21:54

7 Answers7

7

Simply do the following two steps:

1) Delete the App from the device (or simulator)

2) Clean your workspace (CMD+SHIFT+K or via menu Product->Clean)

3) Build and run your app again.

Magically helps every time with all that startup / deploy stuff...

I also often get something like "application not found on device" or signing problems etc. Minutes before everything worked well.

Frithjof Schaefer
  • 1,135
  • 11
  • 22
6

This appears to possibly be a code signing issue on Apple's part, and the issue seems affect apps with embedded frameworks (including non-Swift apps). There are multiple accounts of developers being affected (myself included) who had only submitted an update, without changing any build settings. Some high profile apps appear to have been affected and tickets have been filed with Apple, but there has been no official response from them at this time.

EDIT: This has been confirmed.

rjsamson
  • 61
  • 3
2

Edit:

The app was rejected, after making this change, for the same reason, however, I am confident that the problem has to do with a missing architecture version in the libswiftCore.


I am going to post this as the provisional answer. Xcode 6 Standard architectures exclude armv7s

Notice how the error says: Did find: /path/to/my/app/Frameworks/libswiftCore.dylib

So it did find the lib but it also says: Reason: no suitable image found.

After running lipo against the archived build it didn't contain armv7s in the swift library, or in the app binary. I manually added it per the link above and the binary now contains support for armv7s though the swift library still did not. My app is in expedited review so I should get feedback farily quick. I will follow up when that does happen.

Community
  • 1
  • 1
maxpower
  • 1,203
  • 11
  • 20
  • My project does have armv7s as a valid architecture, yet i still saw this problem. – Daniel Oct 03 '14 at 22:37
  • Mine did not. I just resubmitted with this armv7s added. Thank you maxpower. I will let you know the outcome. – AgnosticDev Oct 03 '14 at 22:38
  • @AgnosticDev is this to be added in valid architecture or in the architectures setting? My project did not have it in the architecture setting, so I added that now.. – Daniel Oct 03 '14 at 22:41
  • In the architecture settings. – AgnosticDev Oct 03 '14 at 22:50
  • My app just went into review and was almost immediately rejected now. Apple is saying that the app crashes on load. Even though it was let through to the store just 24 hours ago with the exact same issue. – AgnosticDev Oct 03 '14 at 23:45
  • Experiencing the same, was directed here by: https://devforums.apple.com/thread/248897?start=0 – Dustin Hoffman Oct 04 '14 at 01:45
  • I added armv7s as well, and set "Embedded content contains swift code" to "YES", resubmitting my expedited app as well, hopefully it works. Will update as well. – Dustin Hoffman Oct 04 '14 at 01:46
  • Actually, got complaint on compile/archive with armv7s. Feeling that is unlikely anyhow because the standard default should be good for my app (nothing too crazy going on). – Dustin Hoffman Oct 04 '14 at 01:54
  • I read in here http://stackoverflow.com/questions/25297638/how-do-i-codesign-a-swift-app-via-the-commandline that it could be related to the certificate and provisioning profile. In the team my account is in, i don't have permissions to recreate the certificate. Can anyone confirm? – Andres C Oct 06 '14 at 17:44
  • 1
    I think Apple has resolved this issue. @AndresC if you are having problems you can try that, but from what I could tell that was only helping Enterprise accounts, not accounts that deliver to the app store. – maxpower Oct 06 '14 at 19:39
  • Yeah, I have an enterprise account, so this is exactly my problem! – Andres C Oct 06 '14 at 20:04
  • 1
    Managed to fix it recreating the certificate and provisioning profile! – Andres C Oct 06 '14 at 20:25
  • 1
    @AndresC We tried that too and it worked. Also we found a blog post talking about the issue : https://www.airsignapp.com/ios-apps-using-swift-crash-when-signed-with-inhouse-certificate/ – warchimede Nov 05 '14 at 13:29
2

I had the exact same problem with one of my app version updates (FunKeyBoard 1.1).

After doing some research, looks like it was an Apple side issue for many apps updated on October 3rd. Apple fixed the issue on October 4th by releasing an update, same version number, without needing any fix/re-upload from the app developer.

Obviously an Apple side issue, but I'm surprised Apple is very quiet about it. Many developers, including myself, got angry emails from users, and poor app reviews, as a result.

2

This error typically occurs when signing Swift apps with certificates that lack "OU" (Organizational Unit). All certificates created after the release of iOS 8 should have this. The simple solution is to create a new certificate to sign with.

For more details, see the official Apple comment here: https://developer.apple.com/library/ios/qa/qa1886/_index.html

emidander
  • 2,383
  • 22
  • 29
0

It seems that my on the iTunes store is now downloading and opening as expected. From what I have been reading in the Apple Developer Forums, other apps are also working now too. I have not received any word from Apple on why this happened or what caused this. I opened up a technical support ticket with them and I also contacted iTunes Connect support and there is no explanation or any information on this issue being resolved. This is pretty poor customer service on their part.

AgnosticDev
  • 1,843
  • 2
  • 20
  • 36
0

I had the same problem. I removed support for arm64 and added armv7s and now apple review team approve the app.