App crashes immediately on start up.. Crash in iOS9 on release only through TestFlight or Store. Distributed with Xcode 8

I have an iPhone app which is crashing on iOS9 devices only after being released through TestFlight or the App Store. The build specs are:



Deployment target 8.1

Base SDK: Latest iOS (iOS 10.1)



Before I post the crash logs I wanted to mention that this app has been on the app store for the past 2 years and has never had issues. We have done 3 updates to the app store this year with 2 of those being after iOS10 was released and there were no issues with iOS9 devices.



The odd thing is that we are using Crashlytics and it has reported over 600 crashes, each one of those a singular crash that points to either an internal apple framework or private API. I have got an iOS 9.2.1 device that is also crashing that I have pulled the logs from. They are starting to follow a trend however I need some help deciphering the cause of the crashes.



Crash 1:



Thread 0 Crashed:

0 libobjc.A.dylib 0x22fb3af6 objc_msgSend + 22

1 libobjc.A.dylib 0x22fc0f8a objc_object::sidetable_release(bool) + 150

2 libobjc.A.dylib 0x22fc13cc (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 388

3 FrontBoardServices 0x24aebc7e -[FBSSerialQueue _performNext] + 242

4 FrontBoardServices 0x24aebf60 -[FBSSerialQueue _performNextFromRunLoopSource] + 44

5 CoreFoundation 0x2379d256 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14

6 CoreFoundation 0x2379ce46 __CFRunLoopDoSources0 + 454

7 CoreFoundation 0x2379b1ae __CFRunLoopRun + 806

8 CoreFoundation 0x236edbb8 CFRunLoopRunSpecific + 516

9 CoreFoundation 0x236ed9ac CFRunLoopRunInMode + 108

10 UIKit 0x279dfa16 -[UIApplication _run] + 526

11 UIKit 0x279d9fb4 UIApplicationMain + 144

12 Where Next 0x000a7816 main (main.m:16)

13 libdyld.dylib 0x233a0872 start + 2



Crash 2:



Thread 0 Crashed:

0 libobjc.A.dylib 0x22fb3af6 objc_msgSend + 22

1 CoreUI 0x277e3022 -[CUICatalog _resolvedRenditionKeyFromThemeRef:withBaseKey:scaleFactor:devic eIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:] + 646

2 CoreUI 0x277e2d98 -[CUICatalog _resolvedRenditionKeyForName:scaleFactor:deviceIdiom:deviceSubt ype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:withBaseKeySelector:] + 284

3 CoreUI 0x277e252a -[CUICatalog namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 94

4 UIKit 0x28183a2c __98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 496

5 UIKit 0x2818377e -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 230

6 UIKit 0x2798bcd4 -[_UIAssetManager imageNamed:scale:idiom:subtype:] + 108

7 UIKit 0x2798bc62 -[_UIAssetManager imageNamed:idiom:subtype:] + 46

8 UIKit 0x2798bc2e -[_UIAssetManager imageNamed:idiom:] + 46

9 UIKit 0x27e1e438 -[UIImageNibPlaceholder initWithCoder:] + 456

10 UIKit 0x27f32180 UINibDecoderDecodeObjectForValue + 780

11 UIKit 0x27f31e68 -[UINibDecoder decodeObjectForKey:] + 296

12 UIKit 0x27e0a602 -[UIButtonContent initWithCoder:] + 382

13 UIKit 0x27f32180 UINibDecoderDecodeObjectForValue + 780

14 UIKit 0x27f3250c UINibDecoderDecodeObjectForValue + 1688

15 UIKit 0x27f31e68 -[UINibDecoder decodeObjectForKey:] + 296

16 UIKit 0x27e0d03c -[UIButton initWithCoder:] + 748

17 UIKit 0x27f32180 UINibDecoderDecodeObjectForValue + 780

18 UIKit 0x27f31e68 -[UINibDecoder decodeObjectForKey:] + 296

19 UIKit 0x27e1d202 -[UIRuntimeConnection initWithCoder:] + 114

20 UIKit 0x27e1d88c -[UIRuntimeEventConnection initWithCoder:] + 52

21 UIKit 0x27f32180 UINibDecoderDecodeObjectForValue + 780

22 UIKit 0x27f32112 UINibDecoderDecodeObjectForValue + 670

23 UIKit 0x27f31e68 -[UINibDecoder decodeObjectForKey:] + 296

24 UIKit 0x27e1c796 -[UINib instantiateWithOwner:options:] + 1110

25 UIKit 0x27cd6676 -[UIViewController _loadViewFromNibNamed:bundle:] + 322

26 UIKit 0x27aab9d6 -[UIViewController loadView] + 142

27 UIKit 0x27971a0a -[UIViewController loadViewIfRequired] + 150

28 UIKit 0x27971958 -[UIViewController view] + 24

29 UIKit 0x281edf4a __67-[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 498

30 UIKit 0x280642d4 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 432

31 UIKit 0x28064102 -[UIStoryboardSegueTemplate _perform:] + 66

32 UIKit 0x28064374 -[UIStoryboardSegueTemplate perform:] + 132

33 UIKit 0x27971bca -[UIViewController loadViewIfRequired] + 598

34 UIKit 0x27971958 -[UIViewController view] + 24

35 UIKit 0x279786d0 -[UIWindow addRootViewControllerViewIfPossible] + 68

36 UIKit 0x27975bf2 -[UIWindow _setHidden:forced:] + 278

37 UIKit 0x279ea914 -[UIWindow makeKeyAndVisible] + 48

38 UIKit 0x27c0f11c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3320

39 UIKit 0x27c12f0e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1570

40 UIKit 0x27c26c14 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3228 + 36

41 UIKit 0x27c103f6 -[UIApplication workspaceDidEndTransaction:] + 134

42 FrontBoardServices 0x24aebc74 -[FBSSerialQueue _performNext] + 232

43 FrontBoardServices 0x24aebf60 -[FBSSerialQueue _performNextFromRunLoopSource] + 44

44 CoreFoundation 0x2379d256 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14

45 CoreFoundation 0x2379ce46 __CFRunLoopDoSources0 + 454

46 CoreFoundation 0x2379b1ae __CFRunLoopRun + 806

47 CoreFoundation 0x236edbb8 CFRunLoopRunSpecific + 516

48 CoreFoundation 0x236ed9ac CFRunLoopRunInMode + 108

49 UIKit 0x279dfa16 -[UIApplication _run] + 526

50 UIKit 0x279d9fb4 UIApplicationMain + 144

51 Where Next 0x000e8816 main (main.m:16)

52 libdyld.dylib 0x233a0872 start + 2

Crash 3:



Thread 0 Crashed:

0 libsystem_malloc.dylib 0x2349c43a tiny_free_list_remove_ptr + 126

1 libsystem_malloc.dylib 0x2349b4d0 szone_free_definite_size + 932

2 libcache.dylib 0x2330d6f4 cache_set_name + 20

3 CoreFoundation 0x2372eb94 -[NSCache setName:] + 136

4 CoreUI 0x277e2f0e -[CUICatalog _resolvedRenditionKeyFromThemeRef:withBaseKey:scaleFactor:devic eIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:] + 370

5 CoreUI 0x277e2d98 -[CUICatalog _resolvedRenditionKeyForName:scaleFactor:deviceIdiom:deviceSubt ype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:withBaseKeySelector:] + 284

6 CoreUI 0x277e252a -[CUICatalog namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 94

7 UIKit 0x28183a2c __98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 496

8 UIKit 0x2818377e -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 230

9 UIKit 0x28183f50 -[_UIAssetManager imageNamed:withTrait:] + 408

10 UIKit 0x27c4e94c +[UIImage imageNamed:inBundle:compatibleWithTraitCollection:] + 172

11 UIKit 0x27aae536 +[UIImage imageNamed:] + 110

12 Where Next 0x000e555e -[PreferenceObject resetLocations] (PreferenceObject.m:184)

13 Where Next 0x000e4b6e __33+[PreferenceObject sharedManager]_block_invoke (PreferenceObject.m:92)

14 libdispatch.dylib 0x23377dc2 _dispatch_client_callout + 22

15 libdispatch.dylib 0x233789b2 dispatch_once_f + 62

16 Where Next 0x000e4980 +[PreferenceObject sharedManager] (once.h:75)

17 Where Next 0x00102440 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:57)

18 Where Next 0x002ced6a VMDidFinishLaunchingWithOptions (UIApplication+VMRuntime.m:138)

19 UIKit 0x279e664e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 394

20 UIKit 0x27c0f032 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3086

21 UIKit 0x27c12f0e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1570

22 UIKit 0x27c26c14 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3228 + 36

23 UIKit 0x27c103f6 -[UIApplication workspaceDidEndTransaction:] + 134

24 FrontBoardServices 0x24aebc74 -[FBSSerialQueue _performNext] + 232

25 FrontBoardServices 0x24aebf60 -[FBSSerialQueue _performNextFromRunLoopSource] + 44

26 CoreFoundation 0x2379d256 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14

27 CoreFoundation 0x2379ce46 __CFRunLoopDoSources0 + 454

28 CoreFoundation 0x2379b1ae __CFRunLoopRun + 806

29 CoreFoundation 0x236edbb8 CFRunLoopRunSpecific + 516

30 CoreFoundation 0x236ed9ac CFRunLoopRunInMode + 108

31 UIKit 0x279dfa16 -[UIApplication _run] + 526

32 UIKit 0x279d9fb4 UIApplicationMain + 144

33 Where Next 0x00103816 main (main.m:16)

34 libdyld.dylib 0x233a0872 start + 2



The last two crashes look like they may be failing on finding an image asset... However because I cannot get this to replicate in debug mode or any form of "run" from Xcode I am stuck.



Appreciate the help community!

Crashes 1 and 3 definitely look like a memory management problem, and crash 2 could be as well. You should start by deploying the standard memory management debugging techniques, including:

  • Zombies

  • Address Sanitiser

Share and Enjoy

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

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

Were you able to fix the crash? what was the issue. I have the same problem with my app.

I just had something very similar - Testflight or App Store builds on iOS 9.2.x variants causing weird crashes that looked an awful lot like memory corruption issues for an app that had been rock-solid up to that point. Exactly the same thing you're seeing: dud objc_msgSend failures and crashes in memory routines like free, release and malloc.


Local builds (not run though Testflight or the App Store) were fine. Fortunately I had a working variation of a similar app we'd written to compare with, and it turned out it was a specific PNG in the included assets. I couldn't actually see anything wrong with the PNG - it seemed perfectly valid - but when I re-encoded it my problem went away.


I decided combination of a weird PNG and app thinning (because it only happens for TestFlight/AppStore builds) causes an issue in the PNG decoding, but it's pure guess-work on my part. The security update details for iOS do show occasional memory corruption issue fixed in ImageIO (e.g. https://support.apple.com/en-gb/HT206902) so it's not total fantasy.

Anyhow, recompressing the PNG with ImageOptim fixed the problem for me. Might be worth re-encoding all your image assets?

I am facing a very similar issue, with a lot of crashes related to the framework on production builds exclusively on iOS9.x devices. On my side I have no zombies nor memory leaks since the crashes happen directly at startup. Were you able to solve the problem ? Was it related to memory management issues ?

The vast majority of crashes that only show up in TestFlight (and App Review and with end users) are caused by differences between the Debug and Release build configurations. It’s very easy for a problem to be exposed by compiler optimisations that only show up in Release builds. Thus, it’s vital that you test your release build on your desktop and then deploy exactly that same build to TestFlight and so on.

Xcode’s Organizer facilitates this by allowing you to create a single archive that you can distribute in many different ways (including Save for Development Deployment, which then allows you to attach with the debugger and debug your problems).

DTS has created a document, Technote 2431 App Testing Guide, that covers the most common causes of problems only showing up in Release builds.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
App crashes immediately on start up.. Crash in iOS9 on release only through TestFlight or Store. Distributed with Xcode 8
 
 
Q