简体   繁体   English

当没有网络连接时,iOS应用程序在启动时崩溃

[英]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: 不会调用单个viewDidLoad甚至AppDelegate函数,并且错误消息似乎与没有网络连接有关:

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'' 2019-03-21 10:30:20.193955-0500 AppName [98957:977030] ***由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无法在bundle中加载NIB:'NSBundle <bundleFilePath>(已加载)'名字'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. 尝试在[UIViewController _loadViewFromNibNamed:bundle:]设置一个符号断点,但这并没有给出任何有用的见解。 Hope someone can help. 希望有人能提供帮助。 I should also mention the only thing I'm doing in AppDelegate is instantiating firebase. 我还要提到我在AppDelegate唯一要做的就是实例化firebase。

Helpful guy over at reddit figured it out for me. 在reddit有用的家伙为我找到了它。 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. 没有意识到,但我的初始视图控制器上有一个init()函数,最后一个人检查了互联网连接并重定向到另一个页面,如果没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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