我正在尝试使用Storyboard在导航视图中嵌入导航控制器。我将Container View添加到场景中,删除自动生成的View Controller,然后从Container View拖动到我的Navigation Controller,创建一个segue。
当我在模拟器中运行应用程序并转换到包含容器视图的场景时,我得到以下异常:
2018-04-28 15:22:40.278627-0400 Woofr [8977:18656423] ***由于未捕获的异常终止应用程序' NSUnknownKeyException',原因:' [setValue:forUndefinedKey: ]:此类不是密钥容器视图的键值编码兼容。'
如果我只使用原始自动生成的View Controller将其作为测试运行,它就可以运行。如果我控制 - 从容器视图拖动到导航控制器而不删除自动生成的视图控制器,则会在故事板中替换segue,但在运行应用程序时会出现相同的异常。
ETA完整堆栈跟踪:
2018-04-28 15:44:22.748243-0400 Woofr[15437:18687945] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIStoryboardShowSegueTemplate 0x6040004756c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key containerView.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001078521e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010699a031 objc_exception_throw + 48
2 CoreFoundation 0x00000001078520b9 -[NSException raise] + 9
3 Foundation 0x00000001063bbb47 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x0000000108cc2d56 -[UIRuntimeOutletConnection connect] + 109
5 CoreFoundation 0x00000001077f4e8d -[NSArray makeObjectsPerformSelector:] + 317
6 UIKit 0x0000000108cc1700 -[UINib instantiateWithOwner:options:] + 1856
7 UIKit 0x00000001089dc137 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
8 UIKit 0x00000001089dca64 -[UIViewController loadView] + 177
9 UIKit 0x00000001089dcd81 -[UIViewController loadViewIfRequired] + 175
10 UIKit 0x00000001089dd5d4 -[UIViewController view] + 27
11 UIKit 0x0000000108a0ec6e -[UINavigationController _startCustomTransition:] + 945
12 UIKit 0x0000000108a255e2 -[UINavigationController _startDeferredTransitionIfNeeded:] + 714
13 UIKit 0x0000000108a268cc -[UINavigationController __viewWillLayoutSubviews] + 150
14 UIKit 0x0000000108c7ebd7 -[UILayoutContainerView layoutSubviews] + 231
15 UIKit 0x0000000108908808 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
16 QuartzCore 0x00000001045d161a -[CALayer layoutSublayers] + 177
17 QuartzCore 0x00000001045d582b _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
18 QuartzCore 0x000000010455c29f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
19 QuartzCore 0x0000000104589940 _ZN2CA11Transaction6commitEv + 568
20 UIKit 0x000000010883334f _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
21 UIKit 0x0000000109198532 __handleEventQueueInternal + 6875
22 CoreFoundation 0x00000001077f4bb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
23 CoreFoundation 0x00000001077d94af __CFRunLoopDoSources0 + 271
24 CoreFoundation 0x00000001077d8a6f __CFRunLoopRun + 1263
25 CoreFoundation 0x00000001077d830b CFRunLoopRunSpecific + 635
26 GraphicsServices 0x000000010cb86a73 GSEventRunModal + 62
27 UIKit 0x00000001088390b7 UIApplicationMain + 159
28 Woofr 0x0000000100d34427 main + 55
29 libdyld.dylib 0x000000010b050955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
ETA设置场景屏幕截图: