简体   繁体   中英

iOS app crashing on startup when there is no network connection

As the title says, my app immediately crashes when run if there is no internet connection/airplane mode is on. The thing is, when I set breakpoints it doesn't even make it to any of my code. Not a single viewDidLoad or even AppDelegate function gets called, and the error message doesn't seem like something that would be related to not having a network connection:

2019-03-21 10:30:20.193955-0500 AppName[98957:977030] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle <bundleFilePath> (loaded)' with name 'BYZ-38-t0r-view-8bC-Xf-vdC''

(I obviously inserted some fake values into their for privacy)

Call stack:

*** First throw call stack:
(
0   CoreFoundation                      0x00000001036cb1bb __exceptionPreprocess + 331
1   libobjc.A.dylib                     0x0000000102c69735 objc_exception_throw + 48
2   CoreFoundation                      0x00000001036cb015 +[NSException raise:format:] + 197
3   UIKitCore                           0x00000001088edd94 -[UINib instantiateWithOwner:options:] + 497
4   UIKitCore                           0x0000000108661452 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
5   UIKitCore                           0x0000000108661ddc -[UIViewController loadView] + 177
6   UIKitCore                           0x00000001086620ee -[UIViewController loadViewIfRequired] + 175
7   UIKitCore                           0x0000000108662940 -[UIViewController view] + 27
8   UIKitCore                           0x000000010858134c -[UIPresentationController __sizeClassPair] + 62
9   UIKitCore                           0x0000000108675428 -[UIViewController _presentViewController:withAnimationController:completion:] + 2300
10  UIKitCore                           0x000000010867874b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
11  UIKitCore                           0x0000000108678dd9 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
12  UIKitCore                           0x00000001086786b1 -[UIViewController _presentViewController:animated:completion:] + 173
13  UIKitCore                           0x00000001086789f0 -[UIViewController presentViewController:animated:completion:] + 150
14  AppName                        0x0000000100f1125e $SSo16UIViewControllerC12DataScoutProE27showDismissiveAlertMesssage7messageySS_tF + 254
15  AppName                        0x0000000100e58a97 $S12AppName18HomeViewControllerC10commonInit33_90D4AB13D5DB6EAFA2D0742F81F552BALLyyF + 727
16  AppName                        0x0000000100e58462 $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfc + 146
17  AppName                        0x0000000100e584df $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 47
18  UIKitCore                           0x00000001088ec166 -[UIClassSwapper initWithCoder:] + 246
19  UIFoundation                        0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
20  UIFoundation                        0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
21  UIKitCore                           0x00000001088f07b8 -[UIRuntimeConnection initWithCoder:] + 178
22  UIFoundation                        0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
23  UIFoundation                        0x000000010c8f3854 UINibDecoderDecodeObjectForValue + 1428
24  UIFoundation                        0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
25  UIKitCore                           0x00000001088ee067 -[UINib instantiateWithOwner:options:] + 1220
26  UIKitCore                           0x0000000108e228b6 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
27  UIKitCore                           0x0000000108c8103a -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 112
28  UIKitCore                           0x0000000108c8150c -[UIApplication _loadMainInterfaceFile] + 272
29  UIKitCore                           0x0000000108c7fb25 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1357
30  UIKitCore                           0x000000010849e4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
31  UIKitCore                           0x00000001084a729c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
32  UIKitCore                           0x000000010849e126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
33  UIKitCore                           0x000000010849eae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
34  UIKitCore                           0x000000010849ccb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
35  UIKitCore                           0x000000010849c95f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
36  UIKitCore                           0x00000001084a1a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
37  UIKitCore                           0x00000001084a280e _performActionsWithDelayForTransitionContext + 100
38  UIKitCore                           0x00000001084a17ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
39  UIKitCore                           0x00000001084a693a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
40  UIKitCore                           0x0000000108c7e44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
41  UIKitCore                           0x0000000108822d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
42  FrontBoardServices                  0x000000010f55e2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
43  FrontBoardServices                  0x000000010f569443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
44  FrontBoardServices                  0x000000010f568b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
45  libdispatch.dylib                   0x000000010548a602 _dispatch_client_callout + 8
46  libdispatch.dylib                   0x000000010548db78 _dispatch_block_invoke_direct + 301
47  FrontBoardServices                  0x000000010f59dba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
48  FrontBoardServices                  0x000000010f59d860 -[FBSSerialQueue _performNext] + 457
49  FrontBoardServices                  0x000000010f59de40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
50  CoreFoundation                      0x0000000103630721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
51  CoreFoundation                      0x000000010362ff93 __CFRunLoopDoSources0 + 243
52  CoreFoundation                      0x000000010362a63f __CFRunLoopRun + 1263
53  CoreFoundation                      0x0000000103629e11 CFRunLoopRunSpecific + 625
54  GraphicsServices                    0x000000010c5b71dd GSEventRunModal + 62
55  UIKitCore                           0x0000000108c8181d UIApplicationMain + 140
56  AppName                        0x0000000100e8e794 main + 68
57  libdyld.dylib                       0x0000000105500575 start + 1
)

I really have no clue what it could be. Tried setting a symbolic breakpoint at [UIViewController _loadViewFromNibNamed:bundle:] but that didn't really give any useful insight. Hope someone can help. I should also mention the only thing I'm doing in AppDelegate is instantiating firebase.

Helpful guy over at reddit figured it out for me. Didn't realize but there was an init() function on my initial view controller that the last guy made which checked the internet connection and redirected to a different page if there wasn't one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM