Paul Esteban Milan
Paul Esteban Milan

Reputation: 109

Swift UINib Error

Hello I'm a beginner in IOS Swift Development I just want to know what causes these errors

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'There doesn't seem to be a valid compiled storyboard

    'Could not load NIB in bundle: 'NSBundle </Users/dobermaxx/Library/Developer/CoreSimulator/Devices/B6F13A8A-3BDA-4868-97CD-79B62039F7A0/data/Containers/Bundle/Application/F4F3FC83-6133-4184-BD93-CDE0CA3AA688/AppName.app> (loaded)' with name 'aI6-Xc-0KW-view-rPV-ev-7sf' and directory 'Main.storyboardc''
    *** First throw call stack:
    (
0   CoreFoundation                      0x0000000106389d4b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x0000000104a8221e objc_exception_throw + 48
2   CoreFoundation                      0x00000001063f32b5 +[NSException raise:format:] + 197
3   UIKit                               0x0000000108360bd2 -[UINib instantiateWithOwner:options:] + 507
4   UIKit                               0x00000001080f49c5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
5   UIKit                               0x00000001080f52e7 -[UIViewController loadView] + 177
6   UIKit                               0x00000001080f561c -[UIViewController loadViewIfRequired] + 201
7   UIKit                               0x00000001080fc062 -[UIViewController __viewWillAppear:] + 118
8   UIKit                               0x00000001081271d3 -[UINavigationController _startCustomTransition:] + 1290
9   UIKit                               0x0000000108137e48 -[UINavigationController _startDeferredTransitionIfNeeded:] + 697
10  UIKit                               0x0000000108138fdb -[UINavigationController __viewWillLayoutSubviews] + 58
11  UIKit                               0x000000010832fdd7 -[UILayoutContainerView layoutSubviews] + 223
12  UIKit                               0x0000000108018ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
13  QuartzCore                          0x0000000107d3abf8 -[CALayer layoutSublayers] + 146
14  QuartzCore                          0x0000000107d2e440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
15  QuartzCore                          0x0000000107d2e2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16  QuartzCore                          0x0000000107cbc318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
17  QuartzCore                          0x0000000107ce93ff _ZN2CA11Transaction6commitEv + 475
18  QuartzCore                          0x0000000107ce9d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
19  CoreFoundation                      0x000000010632e267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
20  CoreFoundation                      0x000000010632e1d7 __CFRunLoopDoObservers + 391
21  CoreFoundation                      0x0000000106312f8e __CFRunLoopRun + 1198
22  CoreFoundation                      0x0000000106312884 CFRunLoopRunSpecific + 420
23  GraphicsServices                    0x000000010c3e4a6f GSEventRunModal + 161
24  UIKit                               0x0000000107f53c68 UIApplicationMain + 159
25  AppName                              0x0000000103c4b0ff main + 111
26  libdyld.dylib                       0x000000010a1a568d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException

this is the code block that triggers the error

    let entryviewcontroller = self.storyboard?.instantiateViewController(withIdentifier: "vcEntry") as! EntryViewController
            entryviewcontroller.passDate = cell.sqldate
            self.navigationController?.pushViewController(entryviewcontroller, animated: true)

I checked the viewcontroller identifier and it's exactly "vcEntry" now I know this triggers the error because it's part of a collectionview cell and it triggers after the third time I select/tap and I go back to the view with the collection view cell

Upvotes: 1

Views: 334

Answers (2)

Brijesh Shiroya
Brijesh Shiroya

Reputation: 3383

Have you adding navigation controller in storyboard?

Follow this step if you not add a navigation controller in storyboard.

  1. select entryViewController from storyboard.
  2. now go to Editor > EmbedIn > NavigationController
  3. now below code and run your project

Upvotes: 0

Usman Javed
Usman Javed

Reputation: 2455

Have you checked this code with exceptional break point? If not, then please add an exceptional break point and check wether this code causes the crash or not.

This type of crash normally occurs when your XIB is not properly connected to your UIViewController.

Also add a break point on your viewDidLoad event in EntryViewController and check whether your EntryViewController is properly pushed onto Navigationbar or not and let me know please.

Upvotes: 1

Related Questions