Ios 终止应用程序,原因:';故事板()不';t包含标识符为';listview';

Ios 终止应用程序,原因:';故事板()不';t包含标识符为';listview';,ios,swift,xcode,storyboard,Ios,Swift,Xcode,Storyboard,我不知道这个错误的原因 源代码: let roomsbedsViewController = self.storyboard!.instantiateViewController(withIdentifier: "listview") self.present(roomsbedsViewController, animated: true, completion: nil) 错误显示在: let roomsbedsViewController = self.storyboard!.insta

我不知道这个错误的原因

源代码:

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) ***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“情节提要()不包含标识符为“listview”的视图控制器” ***第一次抛出调用堆栈: ( 0 CoreFoundation 0x0000000107eddb0b\uuu异常预处理+171 1 libobjc.A.dylib 0x000000010c362141 objc_异常_抛出+48 2 UIKit 0x000000010aa2193f-[UIStoryboard实例化初始视图控制器]+0 3 DropInn 0x0000000105688a48 TFC7DropInn26属性类型视图控制器7BackBTNFCSO8UIButtont_U4+1704 4 DropInn 0x0000000105688f4a _TTOFC7DropInn26属性类型视图控制器7BackBTNFCSO8UIButtont_+58 5 UIKit 0x000000010a263d22-[UIApplication sendAction:to:from:forEvent:+83 6 UIKit 0x000000010a3e825c-[UIControl发送操作:发送到:forEvent:+67 7 UIKit 0x000000010a3e8577-[UIControl\u发送操作预防:withEvent:+450 8 UIKit 0x000000010a3e74b2-[UIControl触摸附加:withEvent:][618 9 UIKit 0x000000010a2d149a-[UIWindow\u sendTouchesForEvent:+2707 10 UIKit 0x000000010a2d2bb0-[UIWindow sendEvent:+4114 11 UIKit 0x000000010a27f7b0-[UIApplication sendEvent:+352 12 UIKit 0x000000010aa62adc uuu调度预处理事件RomeventQueue+2926 13 UIKit 0x000000010aa5aa3a _-handleEventQueue+1122 14 CoreFoundation 0x0000000107e83c01\uuuu CFRUNLOOP\u正在调用\u OUT\u以执行\u函数\uuuu+17 15 CoreFoundation 0x0000000107e690cf\uuu CFRunLoopDoSources0+527 16 CoreFoundation 0x0000000107e685ff\uuu CFRunLoopRun+911 17 CoreFoundation 0x0000000107e68016 CFRunLoopRunSpecific+406 18图形服务0x000000011034ea24 GSEventRunModal+62 19 UIKit 0x000000010a2620d4 UIApplicationMain+159 20 DropInn 0x0000000105345847 main+55 21 libdyld.dylib 0x000000010da7365d启动+1 ) libc++abi.dylib:以NSException类型的未捕获异常终止 (lldb) 情节提要截图:


在我把故事改编成我的项目后,我遇到了同样的问题


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

请检查使用情节提要ID

当您选中“使用情节提要ID”时,注册ID的文本字段将突出显示您的情节提要ID

在你的例子中。。。 注册ID的文本字段将用列表视图突出显示

希望你的怀疑是清楚的


谢谢

我也有同样的问题

如果您正在使用多个故事板,请尝试以下操作:

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "listView")
使用UIStoryboard(名称:“Main”,bundle:nil)
而不是self.storyboard

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

您的应用程序中是否有多个srotyboard?另外,请尝试一次重写情节提要ID,以便将其删除一次并重新设置。我已经尝试过此方法(重命名我的情节提要ID)。但我仍然面临这个错误,你的应用程序中有多个故事板吗?我在运行之前清理了我的项目。没有,我只有一个故事板