Unity 5.5.0f3 IOS Crash After Screen Sleep

When iphone screen sleep and open again ,game is crash.

IOS Operating System version : 10.2.1

Unity v : 5.5.0f3

This is stack trace .

UnityAppController+Rendering.mm line 256

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x191ec51b8 __exceptionPreprocess
1  libobjc.A.dylib                0x1908fc55c objc_exception_throw
2  CoreFoundation                 0x191ec508c +[NSException raise:format:]
3  Foundation                     0x19297d098 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4  UIKit                          0x197ffda88 _prepareForCAFlush
5  UIKit                          0x19801e250 _beforeCACommitHandler
6  CoreFoundation                 0x191e720c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
7  CoreFoundation                 0x191e6fcf0 __CFRunLoopDoObservers
8  CoreFoundation                 0x191d9e2d8 CFRunLoopRunSpecific
9  spade                          0x100076c30 UnityRepaint (UnityAppController+Rendering.mm:256)
10 spade                          0x1000854c8 -[UnityAppController applicationWillResignActive:] (UnityAppController.mm:363)
11 spade                          0x1014b7190 -[OneSignalAppDelegate oneSignalApplicationWillResignActive:] (UIApplicationDelegate+OneSignal.m:245)
12 UIKit                          0x197de243c -[UIApplication _deactivateForReason:notify:]
13 UIKit                          0x198000398 __61-[UIApplication _sceneSettingsPreLifecycleEventDiffInspector]_block_invoke
14 FrontBoardServices             0x193a84620 __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke.27
15 Foundation                     0x19298f024 __NSIndexSetEnumerate
16 BaseBoard                      0x1939fef68 -[BSSettingsDiff inspectChangesWithBlock:]
17 FrontBoardServices             0x193a7e7b8 -[FBSSettingsDiff inspectOtherChangesWithBlock:]
18 FrontBoardServices             0x193a843fc -[FBSSettingsDiffInspector inspectDiff:withContext:]
19 UIKit                          0x198001800 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
20 UIKit                          0x1980014a4 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]
21 UIKit                          0x19832d53c -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:]
22 FrontBoardServices             0x193a6ddd4 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.376
23 FrontBoardServices             0x193a9b92c __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
24 FrontBoardServices             0x193a9b798 -[FBSSerialQueue _performNext]
25 FrontBoardServices             0x193a74058 -[FBSWorkspace synchronizeSystemAnimationFencesWithCleanUpBlock:]
26 UIKit                          0x197ffd684 -[UIApplication _synchronizeSystemAnimationFencesWithSpinCleanUpBlock:]
27 UIKit                          0x198052664 __realPreCommitHandler_block_invoke
28 QuartzCore                     0x1951bfe10 CA::Transaction::Fence::run_callbacks() const
29 QuartzCore                     0x1951974c4 CA::Context::commit_transaction(CA::Transaction*)
30 QuartzCore                     0x1951bea68 CA::Transaction::commit()
31 QuartzCore                     0x1951bf488 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
32 CoreFoundation                 0x191e720c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
33 CoreFoundation                 0x191e6fcf0 __CFRunLoopDoObservers
34 CoreFoundation                 0x191d9e2d8 CFRunLoopRunSpecific
35 spade                          0x100076c30 UnityRepaint (UnityAppController+Rendering.mm:256)
36 spade                          0x1000769f0 -[UnityAppController(Rendering) repaintDisplayLink] (UnityAppController+Rendering.mm:55)
37 QuartzCore                     0x19511af24 CA::Display::DisplayLinkItem::dispatch(unsigned long long)
38 QuartzCore                     0x19511add0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long)
39 IOKit                          0x192132094 IODispatchCalloutFromCFMessage
40 CoreFoundation                 0x191e5ae50 __CFMachPortPerform
41 CoreFoundation                 0x191e73218 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
42 CoreFoundation                 0x191e729cc __CFRunLoopDoSource1
43 CoreFoundation                 0x191e704b0 __CFRunLoopRun
44 CoreFoundation                 0x191d9e2b8 CFRunLoopRunSpecific
45 GraphicsServices               0x193852198 GSEventRunModal
46 UIKit                          0x197de57fc -[UIApplication _run]
47 UIKit                          0x197de0534 UIApplicationMain
48 spade                          0x1000705ac main (main.mm:32)
49 libdispatch.dylib              0x190d815b8 (Missing)

How can I fix that ?

Hi,

is you set “Behaviour In background” to “Exit” in Build Player Setting? May it will force close you app during app goes to Background mode (as you said crash at time of after screen goes to sleep mode)

I also advice to take copy and try that copy with latest version of Unity v5.5.1p4.

Looks like this is fixed in 5.5.1p3 and is slated for wide release in 5.6.0 currently targeting March 2017

Update 3/2/2017 - It looks like this fix has been published in release 5.5.2, not sure why the issue tracker says that it’s fixed in 5.6.0 rather than 5.5.2 though …
https://unity3d.com/unity/whats-new/unity-5.5.2

I changed my build setting in Xcode from IOS 8 to IOS 9. That did it for me. still don’t know why tho.