终止应用程序,原因:'Storyboard()不包含带有标识符'listview'的视图控制器

时间:2017-07-12 04:23:28

标签: ios swift xcode storyboard

我不知道这个错误的原因。

源代码:

let roomsbedsViewController = self.storyboard!.instantiateViewController(withIdentifier: "listview")

self.present(roomsbedsViewController, animated: true, completion: nil)

错误显示在:

let roomsbedsViewController = self.storyboard!.instantiateViewController(withIdentifier: "listview")

错误日志:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'listview''
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107eddb0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010c362141 objc_exception_throw + 48
    2   UIKit                               0x000000010aa2193f -[UIStoryboard instantiateInitialViewController] + 0
    3   DropInn                             0x0000000105688a48 _TFC7DropInn26PropertyTypeViewController7backBtnfCSo8UIButtonT_ + 1704
    4   DropInn                             0x0000000105688f4a _TToFC7DropInn26PropertyTypeViewController7backBtnfCSo8UIButtonT_ + 58
    5   UIKit                               0x000000010a263d22 -[UIApplication sendAction:to:from:forEvent:] + 83
    6   UIKit                               0x000000010a3e825c -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x000000010a3e8577 -[UIControl _sendActionsForEvents:withEvent:] + 450
    8   UIKit                               0x000000010a3e74b2 -[UIControl touchesEnded:withEvent:] + 618
    9   UIKit                               0x000000010a2d149a -[UIWindow _sendTouchesForEvent:] + 2707
    10  UIKit                               0x000000010a2d2bb0 -[UIWindow sendEvent:] + 4114
    11  UIKit                               0x000000010a27f7b0 -[UIApplication sendEvent:] + 352
    12  UIKit                               0x000000010aa62adc __dispatchPreprocessedEventFromEventQueue + 2926
    13  UIKit                               0x000000010aa5aa3a __handleEventQueue + 1122
    14  CoreFoundation                      0x0000000107e83c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x0000000107e690cf __CFRunLoopDoSources0 + 527
    16  CoreFoundation                      0x0000000107e685ff __CFRunLoopRun + 911
    17  CoreFoundation                      0x0000000107e68016 CFRunLoopRunSpecific + 406
    18  GraphicsServices                    0x000000011034ea24 GSEventRunModal + 62
    19  UIKit                               0x000000010a2620d4 UIApplicationMain + 159
    20  DropInn                             0x0000000105345847 main + 55
    21  libdyld.dylib                       0x000000010da7365d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

故事板截图:

enter image description here

3 个答案:

答案 0 :(得分:1)

请查看使用Storyboard ID .......

当您选中使用Storyboard ID 时,注册ID 的文本字段将突出显示您的Storyboard ID .....

在你的例子中...... 注册ID的文本字段将以 listview

突出显示

enter image description here

希望你的怀疑是明确的

谢谢

答案 1 :(得分:0)

我有同样的问题。

如果您使用多个情节提要,请尝试以下操作:

_mm256_loadu_ps

使用 UIStoryboard(名称:“ Main”,捆绑包:nil),而不是self.storyboard

原因: 如果要从另一个情节提要文件上的视图控制器调用self.storyboard,它将引用该特定的情节提要。不是主要的故事板。

答案 2 :(得分:-1)

在我将故事编写到我的项目后,我遇到了同样的问题

我通过单击stroybord然后单击文件检查器来修复它,然后选择我的目标成员资格。