uikit: -[UIApplication _terminateWithStatus:] + 468

Hi, for some reason my app is getting some crashes. xCode is saying that this is the error:


uikit: -[UIApplication _terminateWithStatus:] + 468


I have no idea how to replicate it myself. Does anyone know what this error could be caused by? My app is made with Unity.


Thanks

Replies

Hi, for some reason my app is getting some crashes.

Please post the full Apple crash report for this problem.

Share and Enjoy

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

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

Getting the same errors on iOS 12 and 12.1
Here is the crash log


Incident Identifier: CB6C8328-7535-49DA-864A-3A9945F5A06C
CrashReporter Key:  795280204e300431f1b39b53fedab0d03676ca9e
Hardware Model:      iPhone9,1
Process:            appnew [7904]
Path:                /private/var/containers/Bundle/Application/C2E0C16D-E2EF-416A-AECE-C188D6BDCFD2/appnew.app/appnew
Identifier:          com.playshifu.appnew
Version:            1 (1.43)
AppStoreTools:      10B63
AppVariant:          1:iPhone9,1:10
Code Type:          ARM-64 (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:          com.playshifu.appnew [1824]




Date/Time:          2018-12-23 09:27:58.1204 -0800
Launch Time:        2018-12-23 09:10:13.5242 -0800
OS Version:          iPhone OS 12.1 (16B92)
Baseband Version:    5.20.00
Report Version:      104


Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0


Thread 0 name:
Thread 0 Crashed:
0  libsystem_kernel.dylib        0x00000001ce23f104 __pthread_kill + 8
1  libsystem_pthread.dylib        0x00000001ce2ba070 pthread_kill$VARIANT$mp + 380 (pthread.c:1492)
2  libsystem_c.dylib              0x00000001ce196d78 abort + 140 (abort.c:94)
3  libsystem_malloc.dylib        0x00000001ce293768 malloc_vreport + 572 (malloc_printf.c:183)
4  libsystem_malloc.dylib        0x00000001ce293924 malloc_report + 64 (malloc_printf.c:192)
5  libsystem_malloc.dylib        0x00000001ce2862d4 free + 376 (malloc.c:1753)
6  libc++.1.dylib                0x00000001cd843120 std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >::~basic_string() + 32 (new:234)
7  libsystem_c.dylib              0x00000001ce197ab4 __cxa_finalize_ranges + 384 (atexit.c:285)
8  libsystem_c.dylib              0x00000001ce197dd8 exit + 24 (exit.c:81)
9  UIKitCore                      0x00000001fb87c670 -[UIApplication _terminateWithStatus:] + 464 (UIApplication.m:6452)
10  UIKitCore                      0x00000001fb1110d4 __98-[__UICanvasLifecycleMonitor_Compatability deactivateEventsOnly:withContext:forceExit:completion:]_block_invoke.279 + 352 (_UICanvasLifecycleMonitor.m:527)
11  UIKitCore                      0x00000001fb880cd0 _runAfterCACommitDeferredBlocks + 296 (UIApplication.m:2744)
12  UIKitCore                      0x00000001fb86eccc _cleanUpAfterCAFlushAndRunDeferredBlocks + 384 (UIApplication.m:2722)
13  UIKitCore                      0x00000001fb89dfa0 _afterCACommitHandler + 132 (UIApplication.m:2774)
14  CoreFoundation                0x00000001ce6377a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1822)
15  CoreFoundation                0x00000001ce63243c __CFRunLoopDoObservers + 412 (CFRunLoop.c:1932)
16  CoreFoundation                0x00000001ce6329dc __CFRunLoopRun + 1264 (CFRunLoop.c:2950)
17  CoreFoundation                0x00000001ce6321cc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
18  GraphicsServices              0x00000001d08a9584 GSEventRunModal + 100 (GSEvent.c:2245)
19  UIKitCore                      0x00000001fb875054 UIApplicationMain + 212 (UIApplication.m:4347)
20  appnew                        0x0000000102f95150 main + 20816 (main.mm:33)
21  libdyld.dylib                  0x00000001ce0f2bb4 start + 4

Here is the crash log

Thanks.

When you post a crash report it’s best to post the whole crash report. In many cases the only way to get useful results from a crash report is to look at the thing as a whole. Fortunately that’s not the case here. If you look at the backtrace for thread 0 there’s some useful clues. But first, some background…

There are two standard terminate paths your app can follow:

  • Terminate while suspended (A) — When the user moves your app to the background the system typically will typically suspend it shortly thereafter. Once the app is suspended the system can remove your app from memory without resuming it.

  • Terminate while active (B) — In some situations the system may need to terminate your app while it’s active. In this case code within your app runs to trigger the termination. You can hear about this by implementing the

    -applicationWillTerminate:
    app delegate method.

Case A has been by far the most common since multitasking was introduced in iOS 4. However, case B does still crop up.

In seems that your app is crashing in case B. Specifically, frames 9 and 8 clearly show that UIKit is terminating your app by calling

exit
. Frame 7 indicates that the system is running an
atexit
handler. Frame 6 suggests that this
atexit
handler is something related to strings. Frame 5 indicates that the
atexit
handler has called
free
. And frameworks 4 through 0 are that call failing for some reason (usually this is either a bad parameter or a corrupt heap).

To investigate this you test case B. You can do this by removing your app from the multitasking UI when it’s at the front. Implement

-applicationWillTerminate:
and set a breakpoint there to confirm that you’re actually hitting case B. From there you can try to track down who installed this
atexit
handler and why it’s crashing.

Share and Enjoy

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

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

Have you fixed the bug? Is theTerminate while active (B) caused it?