第二次启动后在设备上 运行 时崩溃

Crash when running on device after second launch

我不是工程师,所以在我的简单天气应用程序中并排显示摄氏度和华氏度的崩溃让我有点不知所措。我只更新到 iOS 13 SDK 并更改了夜间模式的一些颜色。

应用程序在模拟器中运行良好,并且在从 Xcode 启动时在设备上也能正常启动。但是,当硬关闭应用程序并在设备上重新启动时,我会遇到以下崩溃。我不知道如何调试崩溃,所以我很感激任何帮助!

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

我遇到了同样的崩溃问题,然后我解决了它。我希望您分享以下我的解决方案,但这可能取决于您的应用程序。希望对你有帮助。

苹果论坛this thread,爱斯基摩人的评论救了我(顺便说一句,爱斯基摩人总是在论坛里帮助我)。根据评论,我知道我必须在控制台应用程序中检查我设备的控制台日志,然后我找到了以下日志。

*** 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)'

感谢日志的说明,我发现我的应用程序二进制文件 link Maps.framework 存在问题。所以我把 Maps.framework 放到 Xcode 中的 "Frameworks, Libraries, and Embedded Content"。

因此,我可以解决崩溃问题!(这很奇怪。)我认为这个问题应该由 Xcode 11 负责,需要由 Xcode 解决。