app crashes at launch as release build on iPhone - but debugging is fine

I have imported ios-charts in my Objective-C project, and running it in debug mode is fine. However, today I tried to archive and ad-hoc distribute my app, the app crashes at launch...

I have set the swift optimization to none for release mode, still no luck.

I have no log or trace since it's installed on iPhone 6. I am looking for help if anything I missed...


I tried to remove all swift stuff and archive, everything is as usual now. However, once I drag the swift files into my Objective-C based project, Run(debug) the app is fine. But if archive(release) and install it on iPhone, immediate crash at launch. Anything what I am missing?


I am with latest Xcode and swift official release

What does the crash log say? (Hook up device to Xcode, open Devices window and look at the logs)

How about now?

I have the same problem. I need your help T^T

How about now?

[echoing junkpile’s original response] Please post a symbolicated crash log.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I had the sample issue on iOS 9.2, 9.0, on iPhone 6 pus, iPad mini.

Please help me. I tried but no luck for many days.


Below is sample log I got from device:

============================ Part of the log ======================

Incident Identifier: 3BA99166-BB2B-4E83-89E1-8AD6982559ED

CrashReporter Key: 18f1e8dc235fc49697977300f246dd70cdbaefe5

Hardware Model: iPad4,2

Process: MyApp [4841]

Path: /private/var/mobile/Containers/Bundle/Application/68835641-AA2A-4C20-9547-432C9995BA6C/MyApp.app/MyApp

Identifier: com.asahi.asahishimbun.iphone.MyApp

Version: 6.0.0.0 (6.0.0)

Code Type: ARM-64 (Native)

Parent Process: launchd [1]



Date/Time: 2017-02-23 09:50:16.16 +0700

Launch Time: 2017-02-23 09:46:50.50 +0700

OS Version: iOS 9.2 (13C75)

Report Version: 105



Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000180

Triggered by Thread: 0



Filtered syslog:

None found



Thread 0 name: Dispatch queue: com.apple.main-thread

Thread 0 Crashed:

0 libobjc.A.dylib 0x0000000181d8dbdc objc_msgSend + 28

1 UIKit 0x00000001879ee654 -[UINibStringIDTable lookupKey:identifier:] + 132

2 UIKit 0x00000001879ea2a4 -[UINibDecoder decodeObjectForKey:] + 48

3 UIKit 0x00000001878c9530 -[UINib instantiateWithOwner:options:] + 1380

4 UIKit 0x00000001878cb92c -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 224

5 AsahiDigital 0x00000001000a52bc 0x100060000 + 283324

6 AsahiDigital 0x00000001003a805c 0x100060000 + 3440732

7 AsahiDigital 0x00000001003a8f4c 0x100060000 + 3444556

8 UIKit 0x00000001874000c0 -[UIViewController loadViewIfRequired] + 996

9 UIKit 0x00000001874bfda8 -[UINavigationController _layoutViewController:] + 72

10 UIKit 0x00000001874bfc80 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 416

11 UIKit 0x00000001874beec8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144

12 UIKit 0x00000001874bea6c -[UINavigationController _startDeferredTransitionIfNeeded:] + 868

13 UIKit 0x00000001874be694 -[UINavigationController __viewWillLayoutSubviews] + 60

14 UIKit 0x00000001874be5fc -[UILayoutContainerView layoutSubviews] + 208

15 UIKit 0x00000001873fb778 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656

16 QuartzCore 0x0000000184e0ab2c -[CALayer layoutSublayers] + 148

17 QuartzCore 0x0000000184e05738 CA::Layer::layout_if_needed(CA::Transaction*) + 292

18 QuartzCore 0x0000000184e055f8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32

19 QuartzCore 0x0000000184e04c94 CA::Context::commit_transaction(CA::Transaction*) + 252

20 QuartzCore 0x0000000184e049dc CA::Transaction::commit() + 512

21 QuartzCore 0x0000000184dfe0cc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80

22 CoreFoundation 0x00000001826c4588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32

23 CoreFoundation 0x00000001826c232c __CFRunLoopDoObservers + 372

24 CoreFoundation 0x00000001826c275c __CFRunLoopRun + 928

25 CoreFoundation 0x00000001825f1680 CFRunLoopRunSpecific + 384

26 GraphicsServices 0x0000000183b00088 GSEventRunModal + 180

27 UIKit 0x0000000187468d90 UIApplicationMain + 204

28 AsahiDigital 0x00000001000fb314 0x100060000 + 635668

29 libdyld.dylib 0x00000001821928b8 start + 4



Thread 1 name: Dispatch queue: com.apple.libdispatch-manager

This kind of crash only happens on the versions between iOS 9.0.2 and iOS 9.2.x, and only on the apps from App Store. The stack information just points to the function which call the method "loadNibNamed:owner:options". It confuses us.

When you install the app to the device on debug mode or release mode through Xcode, it's normal and will not encounter this crash any longer.



In Xcode 8 or Xcode 9, when your project contains the picture which DisplayGamut is P3 or Encoding is ARGB-16, this kind of crash will happens on the device who download the app from App Store. So it's smart to replace the picture. The fastest way is as follows:

1.find the Assets.car file in the .ipa

2.use assetutil command to product pictures' json, just like this:

sudo xcrun --sdk iphoneos assetutil --info Assets.car > Assets.json

3.it's easy to find "DisplayGamut": "P3" string in the Assets.json;

just replace the picture with a new one.

app crashes at launch as release build on iPhone - but debugging is fine
 
 
Q