由于未被捕获的NSException'NSInvalidArgumentException'

时间:2017-03-25 11:09:41

标签: swift xcode uibutton segue

我在 Swift 中编写了两个 Xcode 项目(SampleMain,SampleTest),这些项目被带入一个名为Sample的工作区。然后我尝试使用UIStoryboard引用按钮将SampleMain的UIStoryboard(Main)合并到SampleTest的UIStoryboard(Main)。当我运行应用程序时,没有异常被捕获,直到按下用于segue的按钮。按下按钮后,应用程序将在控制台日志中以NSException终止。

  

由于未捕获的异常而终止应用   'NSInvalidArgumentException',原因:'Storyboard()不包含   查看具有标识符'test''的控制器*首先抛出调用堆栈:(0   CoreFoundation 0x000000010e17334b exceptionPreprocess + 171 1   libobjc.A.dylib 0x000000010b5c021e objc_exception_throw + 48 2 UIKit   0x000000010c2622bf - [UIStoryboard instantiateInitialViewController] +   0 3 UIKit 0x000000010c048392 - [UIStoryboardViewControllerPlaceholder   initWithCoder:] + 143 4 UIKit 0x000000010c098dbd   UINibDecoderDecodeObjectForValue + 684 5 UIKit 0x000000010c098b0a    - [UINibDecoder decodeObjectForKey:] + 98 6 UIKit 0x000000010be9d15c - [UIRuntimeConnection initWithCoder:] + 178 7 UIKit 0x000000010c098dbd UINibDecoderDecodeObjectForValue + 684 8 UIKit 0x000000010c098f73   UINibDecoderDecodeObjectForValue + 1122 9 UIKit 0x000000010c098b0a    - [UINibDecoder decodeObjectForKey:] + 98 10 UIKit 0x000000010be9c300 - [UINib instantiateWithOwner:options:] + 1249 11 UIKit 0x000000010c2621ab - [UIStoryboard   instantiateViewControllerWithIdentifier:] + 181 12 UIKit   0x000000010c269fab - [UIStoryboardSegueTemplate   instantiateOrFindDestinationViewControllerWithSender:] + 90 13 UIKit   0x000000010c26a1ff - [UIStoryboardSegueTemplate _perform:] + 52 14   UIKit 0x000000010c26a4df - [UIStoryboardSegueTemplate执行:] + 156   15 UIKit 0x000000010ba91b88 - [UIApplication   sendAction:to:from:forEvent:] + 83 16 UIKit 0x000000010bc172b2    - [UIControl sendAction:to:forEvent:] + 67 17 UIKit 0x000000010bc175cb - [UIControl _sendActionsForEvents:withEvent:] + 444 18 UIKit 0x000000010bc164c7 - [UIControl touchesEnded:withEvent:] + 668 19 UIKit   0x000000010baff0d5 - [UIWindow _sendTouchesForEvent:] + 2747 20 UIKit   0x000000010bb007c3 - [UIWindow sendEvent:] + 4011 21 UIKit   0x000000010baada33 - [UIApplication sendEvent:] + 371 22 UIKit   0x000000010c29fb6d __dispatchPreprocessedEventFromEventQueue + 3248 23   UIKit 0x000000010c298817 __handleEventQueue + 4879 24 CoreFoundation   0x000000010e118311   __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 25 CoreFoundation 0x000000010e0fd59c __CFRunLoopDoSources0 + 556 26   CoreFoundation 0x000000010e0fca86 __CFRunLoopRun + 918 27   CoreFoundation 0x000000010e0fc494 CFRunLoopRunSpecific + 420 28   GraphicsServices 0x000000011001ca6f GSEventRunModal + 161 29 UIKit   0x000000010ba8ff34 UIApplicationMain + 159 30 SampleMain   0x000000010afe4e2f main + 111 31 libdyld.dylib 0x000000010f09d68d   start + 1)libc ++ abi.dylib:以未捕获的异常终止   输入NSException(lldb)

我已按以下方式配置了故事板参考:

storyboard reference

SampleMain - Main.storyboard

SampleMain - Main.storyboard

我做错了什么?如果我合并两个不同项目的两个故事板的方法是不正确的;请解释一下这样做的方法。

0 个答案:

没有答案