UINavigationController在Xcode 9上崩溃 [英] UINavigationController Crashes on Xcode 9

查看:1097
本文介绍了UINavigationController在Xcode 9上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我尝试在我的应用程序上使用navigationController推送视图时,我都会收到下面提供的控制台消息。但是,如果我只推动简单的视图控制器它工作正常,它只发生在导航控制器上。

Every time I try to push a view with navigationController on my application I get the console message provided below. But if I only push the simple view controller it works fine, it happens only with navigation controller.

我没有使用第三方库推送视图,我查了一下UIkit框架没关系,我也在构建之前清理项目,也尝试使用与我的自定义视图控制器不同的新视图控制器,但错误是相同的,它只发生在新版本的Xcode 9.0上,在早期版本8.0上这没有不会发生。

I'm not using a third party library to push views, I checked UIkit framework is OK, I also clean the project before building, also tried with a new view controller different from my custom view controller but the error is the same, it is only happening on new version of Xcode 9.0, on Previous version 8.0 this didn't happen.


*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Sigh. Contentview size is zero.'

*** First throw call stack:
(
0   CoreFoundation                      0x000000010d6ec1cb __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00000001132a5f41 objc_exception_throw + 48
2   CoreFoundation                      0x000000010d6f1362 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x000000010eabb089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4   UIKit                               0x00000001110d7701 -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight] + 265
5   UIKit                               0x00000001110da40e -[_UINavigationBarVisualProviderModernIOS heightRangeFittingWidth:] + 427
6   UIKit                               0x00000001110da253 -[_UINavigationBarVisualProviderModernIOS sizeThatFits:] + 138
7   UIKit                               0x000000011105443d -[UIView(UIConstraintBasedLayout) systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 246
8   UIKit                               0x00000001106cc900 -[UINavigationController setNavigationBar:] + 348
9   UIKit                               0x00000001106cc677 -[UINavigationController _navigationBarHiddenByDefault:] + 161
10  UIKit                               0x00000001106d4a7d -[UINavigationController loadView] + 183
11  UIKit                               0x0000000110697941 -[UIViewController loadViewIfRequired] + 195
12  UIKit                               0x000000011069819e -[UIViewController view] + 27
13  UIKit                               0x00000001106e36f6 -[UINavigationController pushViewController:transition:forceImmediate:] + 676
14  UIKit                               0x00000001106e31d2 -[UINavigationController pushViewController:animated:] + 792
15  UIKit                               0x00000001106c2cd1 -[UINavigationController initWithRootViewController:] + 125
16  Tigo Money Staging                  0x000000010a1add26 -[MTAppDelegate openStartUp] + 358
17  Tigo Money Staging                  0x000000010a1ac8c1 -[MTAppDelegate application:didFinishLaunchingWithOptions:] + 241
18  UIKit                               0x00000001104f135a -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 267
19  UIKit                               0x00000001104f2db7 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4105
20  UIKit                               0x00000001104f8245 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
21  UIKit                               0x00000001108b3c6c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
22  UIKit                               0x0000000110c813ef +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
23  UIKit                               0x00000001108b3865 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
24  UIKit                               0x00000001108b40c3 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668
25  UIKit                               0x0000000111211c11 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
26  UIKit                               0x0000000111211aca -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
27  UIKit                               0x0000000110effb9c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420
28  UIKit                               0x00000001110fac3e _performActionsWithDelayForTransitionContext + 100
29  UIKit                               0x0000000110eff998 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
30  UIKit                               0x0000000110c80a4c -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
31  UIKit                               0x00000001104f6ac6 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
32  UIKit                               0x0000000110abf523 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
33  FrontBoardServices                  0x0000000118890158 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
34  FrontBoardServices                  0x0000000118898c4d __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
35  libdispatch.dylib                   0x000000011411743c _dispatch_client_callout + 8
36  libdispatch.dylib                   0x000000011411caf4 _dispatch_block_invoke_direct + 592
37  FrontBoardServices                  0x00000001188c4672 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
38  FrontBoardServices                  0x00000001188c4328 -[FBSSerialQueue _performNext] + 464
39  FrontBoardServices                  0x00000001188c4897 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
40  CoreFoundation                      0x000000010d68f2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
41  CoreFoundation                      0x000000010d72ed31 __CFRunLoopDoSource0 + 81
42  CoreFoundation                      0x000000010d673c19 __CFRunLoopDoSources0 + 185
43  CoreFoundation                      0x000000010d6731ff __CFRunLoopRun + 1279
44  CoreFoundation                      0x000000010d672a89 CFRunLoopRunSpecific + 409
45  GraphicsServices                    0x0000000114ce59c6 GSEventRunModal + 62
46  UIKit                               0x00000001104f9d30 UIApplicationMain + 159
47  Tigo Money Staging                  0x000000010a2f8a5f main + 111
48  libdyld.dylib                       0x0000000114193d81 start + 1
49  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

此处是我在didFinishLaunchingWithOptions上的代码示例

here is an example of my code on didFinishLaunchingWithOptions

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
CustomViewController *startUpVC = [[CustomViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:startUpVC];

使用导航控制器后,它会崩溃。

after use navigationcontroller sentence it crashes.

推荐答案

选择View Controller,然后转到Editor-> Embed In-> Navigation Controller。因为有时控制器不在导航控制器层次结构中,所以当用户想要推送到另一个控制器时应用程序崩溃。希望它会有所帮助。

Select your View Controller and then go to Editor->Embed In->Navigation Controller . Because some time if controller is not in Navigation controller hierarchy then app crash when user want to push to another controller. Hope it will help.

这篇关于UINavigationController在Xcode 9上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆