sabari vasagan
sabari vasagan

Reputation: 402

Terminating app, reason: 'Storyboard () doesn't contain a view controller with identifier 'listview'

I don't know the reason for this error.

Source code:

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

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

Error showing in:

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

Error Log:

*** 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 screenshot:

enter image description here

Upvotes: 4

Views: 2678

Answers (3)

user2201
user2201

Reputation: 39

I had the same problem.

If you are using multiple storyboards then try this:

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "listView")

Use UIStoryboard(name: "Main", bundle: nil) instead of self.storyboard

Reason : If you are calling self.storyboard from a view controller that is on another storyboard file, it will give reference to that particular storyboard; not the main storyboard.

Upvotes: 0

VishalPethani
VishalPethani

Reputation: 852

Please check on use Storyboard ID.......

When you check on use Storyboard ID, The Textfield of Registration ID will be highlighted with your Storyboard ID .....

In your example ... The textfield of registration ID will be highlighted with listview

enter image description here

Hope your doubt is clear

Thank you

Upvotes: 4

iDevMuslim
iDevMuslim

Reputation: 1

i got the same problem after i cope the storybord to my project

and i fix it by clicking stroybord then clicking file inspector and i select my target membership.

Upvotes: -2

Related Questions