ios - 终止应用程序,原因 : 'Storyboard () doesn' t contain a view controller with identifier 'listview'

标签 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) 

Storyboard截图:

enter image description here

最佳答案

请勾选使用 StoryboardID......

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

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

突出显示

enter image description here

希望你的疑问是清楚的

谢谢

关于ios - 终止应用程序,原因 : 'Storyboard () doesn' t contain a view controller with identifier 'listview' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45048401/

相关文章:

ios - 在扩展中添加和删除 Notification Observer

arrays - 迭代数组并计数从负到正的变化(反之亦然)

Swift5 @dynamicMemberLookup 函数

swift - Xcode 8 Beta 6 中出现奇怪的 SceneKit 链接器错误

ios - 如何在 iOS 图表中简化突出显示动画

ios - 如何在 iOS 客户端中解码来自 SimpleMembership 的哈希字符串?

ios - 在 SpriteKit 中更改 contactTestBitMask 后检测接触

ios - MonoTouch 中包含 500 个项目的 UITableView

ios - "No matching provisioning profiles"XCode 7.3提交应用到App Store时

ios - 批量 NSLayoutConstraint 激活/停用