iOS 仅在 iOS 12 台设备上从 App Store 下载时,应用程序在启动时崩溃

iOS app crashes on launch when only when downloaded from App Store on iOS 12 device

我有一个 iOS 应用程序,它在所有设备上都运行良好,除非它们使用 iOS 12。我不确定问题出在哪里。我尝试直接从我的笔记本电脑下载该应用程序,它运行良好。但是,当它从 App Store 或 TestFlight 下载时,它会在启动时崩溃。

这是我的崩溃日志:

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Termination Description: SPRINGBOARD, scene-create watchdog transgression: com.X.X exhausted real (wall clock) time allowance of 18.98 seconds | ProcessVisibility: Background | ProcessState: Running | WatchdogEvent: scene-create | WatchdogVisibility: Foreground | WatchdogCPUStatistics: ( | "Elapsed total CPU time (seconds): 4.380 (user 4.380, system 0.000), 24% CPU", | "Elapsed application CPU time (seconds): 1.411, 8% CPU" | )
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000018b1f6ac4 __msync + 8
1   Realm                           0x0000000101485044 realm::util::msync+ 3117124 (int, void*, unsigned long) + 216
2   Realm                           0x0000000101391078 realm::GroupWriter::commit+ 2117752 (unsigned long) + 264
3   Realm                           0x000000010138bde0 realm::SharedGroup::low_level_commit+ 2096608 (unsigned long long) + 344
4   Realm                           0x000000010138b978 realm::SharedGroup::do_commit+ 2095480 () + 96
5   Realm                           0x000000010138c184 realm::SharedGroup::commit_and_continue_as_read+ 2097540 () + 44
6   Realm                           0x00000001011ceccc realm::_impl::RealmCoordinator::commit_write+ 273612 (realm::Realm&) + 76
7   Realm                           0x00000001012a20f8 realm::Realm::commit_transaction+ 1138936 () + 168
8   Realm                           0x0000000101271628 -[RLMRealm commitWriteTransactionWithoutNotifying:error:] + 288
9   RealmSwift                      0x000000010172826c Realm.write<A>(withoutNotifying:_:) + 115308 (Realm.swift:280)
10  MYAPP                           0x0000000100c7f820 specialized JSONSerializer.serialize(input:) + 178208 (JSONSerializer.swift:30)
11  MYAPP                           0x0000000100cd6fa4 specialized AppDelegate.setUpRealm() + 536484 (AppDelegate.swift:235)
12  MYAPP                           0x0000000100cd5e14 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 531988 (<compiler-generated>:20)
13  UIKitCore                       0x00000001b7e400f0 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 412
14  UIKitCore                       0x00000001b7e41854 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3352
15  UIKitCore                       0x00000001b7e46fe0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1540
16  UIKitCore                       0x00000001b770a2a4 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 776
17  UIKitCore                       0x00000001b771283c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
18  UIKitCore                       0x00000001b7709f28 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
19  UIKitCore                       0x00000001b770a818 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1064
20  UIKitCore                       0x00000001b7708b64 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 744
21  UIKitCore                       0x00000001b770882c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 428
22  UIKitCore                       0x00000001b770d36c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
23  UIKitCore                       0x00000001b770e150 _performActionsWithDelayForTransitionContext + 112
24  UIKitCore                       0x00000001b770d224 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 244
25  UIKitCore                       0x00000001b7711f24 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 360
26  UIKitCore                       0x00000001b7e455e8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
27  UIKitCore                       0x00000001b7a41e04 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360
28  FrontBoardServices              0x000000018dfd79fc -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 440
29  FrontBoardServices              0x000000018dfe140c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 256
30  FrontBoardServices              0x000000018dfe0c14 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 64
31  libdispatch.dylib               0x000000018b0997d4 _dispatch_client_callout + 16
32  libdispatch.dylib               0x000000018b03e5dc _dispatch_block_invoke_direct$VARIANT$mp + 224
33  FrontBoardServices              0x000000018e012040 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
34  FrontBoardServices              0x000000018e011cdc -[FBSSerialQueue _performNext] + 408
35  FrontBoardServices              0x000000018e012294 -[FBSSerialQueue _performNextFromRunLoopSource] + 52
36  CoreFoundation                  0x000000018b5ecf1c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
37  CoreFoundation                  0x000000018b5ece9c __CFRunLoopDoSource0 + 88
38  CoreFoundation                  0x000000018b5ec784 __CFRunLoopDoSources0 + 176
39  CoreFoundation                  0x000000018b5e76c0 __CFRunLoopRun + 1004
40  CoreFoundation                  0x000000018b5e6fb4 CFRunLoopRunSpecific + 436
41  GraphicsServices                0x000000018d7e879c GSEventRunModal + 104
42  UIKitCore                       0x00000001b7e48c38 UIApplicationMain + 212
43  MYAPP                           0x0000000100c5a274 main + 25204 (LanguageExampleCell.swift:16)
44  libdyld.dylib                   0x000000018b0aa8e0 start + 4

我在应用程序第一次启动时序列化了一个大型 Realm 数据库。这是导致问题的原因吗?我没有办法知道,因为当我通过我的电脑安装应用程序时不会发生这种情况。

8badfood是看门狗定时器异常。您必须尽快退出 didFinishLaunching 并显示视图。

如果您必须加载大量数据,那么您应该提供初始 "loading" 视图并执行加载,完成后移至实际的 UI。

这是为了避免给用户留下应用刚刚 "hung".

的印象

您只在 iOS 12 台设备上遇到崩溃的事实可能是因为它们是较旧、较慢的设备。