2017-09-22 36 views
6

Mỗi khi tôi cố gắng đẩy chế độ xem bằng navigationController trên ứng dụng của mình, tôi nhận được thông báo giao diện điều khiển được cung cấp bên dưới. Nhưng nếu tôi chỉ đẩy bộ điều khiển xem đơn giản, nó hoạt động tốt, nó chỉ xảy ra với bộ điều khiển điều hướng.UINavigationController Crashes trên Xcode 9

Tôi không sử dụng thư viện của bên thứ ba để đẩy chế độ xem, tôi đã kiểm tra khung UIkit là OK, tôi cũng xóa sạch dự án trước khi xây dựng, cũng thử với bộ điều khiển chế độ xem khác với bộ điều khiển chế độ xem tùy chỉnh của tôi. tương tự, nó chỉ xảy ra trên phiên bản mới của Xcode 9.0, trên phiên bản trước 8.0 này đã không xảy ra.

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

đây là một ví dụ về mã của tôi trên didFinishLaunchingWithOptions

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

sau khi sử dụng navigationcontroller kết án nó bị treo.

+0

bạn có tìm thấy giải pháp này không? –

+1

chưa, tôi vẫn đang làm việc trên nó –

+0

Có phải xác nhận rằng bạn đã nhúng bộ điều khiển xem trong bộ điều khiển điều hướng không? Và sau đó đẩy đến bộ điều khiển khác? –

Trả lời

0

Tôi đã gặp phải vấn đề tương tự, Khi chúng tôi có bảng phân cảnh được lưu bằng Xcode 8 và mở trong dự án bằng Xcode 9, Điều đó xảy ra vì Xcode 9 lưu tài liệu bằng khu vực an toàn. xib mã nguồn lưu với Xcode 9:

<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> 
<device id="retina4_7" orientation="portrait"> 
    <adaptation id="fullscreen"/> 
</device> 
<dependencies> 
    <deployment identifier="iOS"/> 
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/> 
    <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> 
    <capability name="Safe area layout guides" minToolsVersion="9.0"/> 
    <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 
</dependencies> 
</document> 

nhưng xib lưu với Xcode 8 là:

<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> 
<device id="retina4_0" orientation="portrait"> 
    <adaptation id="fullscreen"/> 
</device> 
<dependencies> 
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> 
    <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 
</dependencies> 
</document> 

thay đổi mã nguồn của kịch bản cho phù hợp.

Hy vọng, nó sẽ hữu ích!

+0

cảm ơn rất nhiều Tôi sẽ cố gắng này, làm cho tinh thần giải pháp của bạn –

+1

Tôi đang chạy vào cùng một vấn đề. Bạn có thể giải thích những gì thay đổi bạn đang đề xuất? Tôi có phải thay đổi mã nguồn trở lại định dạng xcode 8 (không có khu vực an toàn) hay tôi cần đảm bảo tất cả các bảng phân cảnh và Nib có định dạng xcode 9? – pbuchheit

0

Chọn Trình điều khiển chế độ xem của bạn và sau đó chuyển đến Trình chỉnh sửa-> Nhúng trong-> Bộ điều khiển điều hướng. Bởi vì một thời gian nếu bộ điều khiển không nằm trong hệ thống phân cấp Bộ điều khiển điều hướng thì lỗi ứng dụng khi người dùng muốn đẩy đến bộ điều khiển khác. Hy vọng nó sẽ giúp.

+0

Xin chào! trong trường hợp này, View Controller của tôi chỉ có một ".xib" không được nhúng trong bộ điều khiển điều hướng, trong trường hợp này không có trong bảng phân cảnh. Tôi sẽ kiểm tra nó. Cảm ơn câu trả lời của bạn :) –

Các vấn đề liên quan