问题
I am not an engineer, so a bit overwhelmed with this crash in my simple weather app that shows Celsius and Fahrenheit side by side. I only updated to iOS 13 SDK and changed some colors for night mode.
App runs fine in simulator and also launches fine on device when started out of Xcode. However, when hard closing app and re-launching on device I get the following crash. I have no idea how to debug crashes, so I'd appreciate any help!
Incident Identifier: FFECFBCF-3BAB-4372-BA17-CC76247FE9CA
CrashReporter Key: bea3dbf6e834f42395b8e4d8102edeea44de5564
Hardware Model: iPhone10,6
Process: FranzFahrenheit [11575]
Path: /private/var/containers/Bundle/Application/C9ADFBB0-773A-41B4-9D1D-24C915EFDF77/FranzFahrenheit.app/FranzFahrenheit
Identifier: com.bjoernschefzyk.franz
Version: 51 (2.4)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.bjoernschefzyk.franz [3643]
Date/Time: 2019-10-12 13:45:33.8086 -0700
Launch Time: 2019-10-12 13:45:33.4430 -0700
OS Version: iPhone OS 13.1.2 (17A861)
Release Type: User
Baseband Version: 3.01.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x1c258c98c __exceptionPreprocess + 220
1 libobjc.A.dylib 0x1c22b50a4 objc_exception_throw + 55
2 CoreFoundation 0x1c2482054 +[NSException raise:format:] + 107
3 UIFoundation 0x1c5b356f8 UINibDecoderDecodeObjectForValue + 407
4 UIFoundation 0x1c5b35a6c UINibDecoderDecodeObjectForValue + 1291
5 UIFoundation 0x1c5ad1ec8 -[UINibDecoder decodeObjectForKey:] + 315
6 UIKitCore 0x1c69f5354 -[UIView initWithCoder:] + 779
7 UIKitCore 0x1c6940f98 -[UIStackView initWithCoder:] + 67
8 UIFoundation 0x1c5b35838 UINibDecoderDecodeObjectForValue + 727
9 UIFoundation 0x1c5b35a6c UINibDecoderDecodeObjectForValue + 1291
10 UIFoundation 0x1c5ad1ec8 -[UINibDecoder decodeObjectForKey:] + 315
11 UIKitCore 0x1c69f5354 -[UIView initWithCoder:] + 779
12 UIFoundation 0x1c5b35838 UINibDecoderDecodeObjectForValue + 727
13 UIFoundation 0x1c5ad1ec8 -[UINibDecoder decodeObjectForKey:] + 315
14 UIKitCore 0x1c6247c7c -[UIRuntimeConnection initWithCoder:] + 171
15 UIFoundation 0x1c5b35838 UINibDecoderDecodeObjectForValue + 727
16 UIFoundation 0x1c5b35a6c UINibDecoderDecodeObjectForValue + 1291
17 UIFoundation 0x1c5ad1ec8 -[UINibDecoder decodeObjectForKey:] + 315
18 UIKitCore 0x1c6242cc8 -[NSCoder+ 6917320 (UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 487
19 UIKitCore 0x1c62458b8 -[UINib instantiateWithOwner:options:] + 1111
20 UIKitCore 0x1c5f8cb4c -[UIViewController _loadViewFromNibNamed:bundle:] + 363
21 UIKitCore 0x1c5f8d5d8 -[UIViewController loadView] + 175
22 UIKitCore 0x1c5f8d890 -[UIViewController loadViewIfRequired] + 171
23 UIKitCore 0x1c5f8df94 -[UIViewController view] + 27
24 UIKitCore 0x1c5f1d924 -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:] + 511
25 UIKitCore 0x1c5f1db78 -[UIPageViewController setViewControllers:direction:animated:completion:] + 263
26 FranzFahrenheit 0x102219c78 0x102210000 + 40056
27 FranzFahrenheit 0x102218988 0x102210000 + 35208
28 FranzFahrenheit 0x102218e80 0x102210000 + 36480
29 UIKitCore 0x1c5f8907c -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 99
30 UIKitCore 0x1c5f8db8c -[UIViewController loadViewIfRequired] + 935
31 UIKitCore 0x1c5effe68 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 167
32 UIKitCore 0x1c5f00174 -[UINavigationController _startTransition:fromViewController:toViewController:] + 175
33 UIKitCore 0x1c5f00fa8 -[UINavigationController _startDeferredTransitionIfNeeded:] + 1135
34 UIKitCore 0x1c5f022ec -[UINavigationController __viewWillLayoutSubviews] + 163
35 UIKitCore 0x1c5ee6060 -[UILayoutContainerView layoutSubviews] + 223
36 UIKit 0x1f745efac -[UILayoutContainerViewAccessibility layoutSubviews] + 47
37 UIKitCore 0x1c6a25270 -[UIView+ 15184496 (CALayerDelegate) layoutSublayersOfLayer:] + 2139
38 QuartzCore 0x1c8f115f8 -[CALayer layoutSublayers] + 283
39 QuartzCore 0x1c8f15e28 CA::Layer::layout_if_needed+ 1396264 (CA::Transaction*) + 479
40 QuartzCore 0x1c8f21894 CA::Layer::layout_and_display_if_needed+ 1443988 (CA::Transaction*) + 135
41 QuartzCore 0x1c8e6a9f0 CA::Context::commit_transaction+ 694768 (CA::Transaction*, double) + 303
42 QuartzCore 0x1c8e94890 CA::Transaction::commit+ 866448 () + 675
43 UIKitCore 0x1c65b1b1c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 79
44 CoreFoundation 0x1c250a614 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 19
45 CoreFoundation 0x1c2509db4 __CFRunLoopDoBlocks + 263
46 CoreFoundation 0x1c2505030 __CFRunLoopRun + 1099
47 CoreFoundation 0x1c25048bc CFRunLoopRunSpecific + 463
48 GraphicsServices 0x1cc370328 GSEventRunModal + 103
49 UIKitCore 0x1c659a6d4 UIApplicationMain + 1935
50 FranzFahrenheit 0x10223b3dc 0x102210000 + 177116
51 libdyld.dylib 0x1c238f460 start + 3
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001c2384ebc __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001c22a4c1c pthread_kill$VARIANT$armv81 + 192
2 libsystem_c.dylib 0x00000001c21f4824 abort + 100
3 libc++abi.dylib 0x00000001c234d7d4 __cxa_bad_cast + 0
4 libc++abi.dylib 0x00000001c234d9c4 demangling_unexpected_handler+ 6596 () + 0
5 libobjc.A.dylib 0x00000001c22b5358 _objc_terminate+ 25432 () + 124
6 libc++abi.dylib 0x00000001c235a304 std::__terminate(void (*)+ 58116 ()) + 16
7 libc++abi.dylib 0x00000001c2359ed8 __cxa_rethrow + 144
8 libobjc.A.dylib 0x00000001c22b5258 objc_exception_rethrow + 40
9 CoreFoundation 0x00000001c250492c CFRunLoopRunSpecific + 576
10 GraphicsServices 0x00000001cc370328 GSEventRunModal + 104
11 UIKitCore 0x00000001c659a6d4 UIApplicationMain + 1936
12 FranzFahrenheit 0x000000010223b3dc 0x102210000 + 177116
13 libdyld.dylib 0x00000001c238f460 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x00000001c22acad8 start_wqthread + 0
Thread 2:
0 libsystem_malloc.dylib 0x00000001c2275a98 nanov2_calloc$VARIANT$armv81 + 152
1 libsystem_malloc.dylib 0x00000001c2282924 malloc_zone_calloc + 140
2 libsystem_malloc.dylib 0x00000001c2282924 malloc_zone_calloc + 140
3 libsystem_malloc.dylib 0x00000001c2283208 calloc + 32
4 libobjc.A.dylib 0x00000001c22c6910 class_createInstance + 40
5 libdispatch.dylib 0x00000001c2259a20 _os_object_alloc_realized + 40
6 libdispatch.dylib 0x00000001c2230a90 dispatch_mach_msg_create$VARIANT$armv81 + 108
7 libdispatch.dylib 0x00000001c222d4a0 _dispatch_mach_merge_msg$VARIANT$armv81 + 136
8 libdispatch.dylib 0x00000001c22479b0 _dispatch_event_loop_merge$VARIANT$armv81 + 148
9 libdispatch.dylib 0x00000001c2241308 _dispatch_workloop_worker_thread + 268
10 libsystem_pthread.dylib 0x00000001c22a9fa4 _pthread_wqthread + 276
11 libsystem_pthread.dylib 0x00000001c22acae0 start_wqthread + 8
回答1:
I encountered the same crash issue and then I resolved it. I would like you to share the following my solution, but it might depend on your app. I hope it would help you.
In this thread in Apple's forum, eskimo's comment saved me(By the way, eskimo always helps me in the forum). According to the comment, I knew I had to check console logs of my device in Console app and then I found the following log.
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView because no class named MKMapView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'
Thanks to the log's instruction, I figured out there was a problem to link Maps.framework with my app binary. So I put Maps.framework into "Frameworks, Libraries, and Embedded Content" in Xcode.
As a result, I could resolved the crash issue!(That's weird.) I think this issue should be owned by Xcode 11 and it needs to be fixed by Xcode.
来源:https://stackoverflow.com/questions/58358397/crash-when-running-on-device-after-second-launch