gpt4 book ai didi

ios - swift UINib 错误

转载 作者:行者123 更新时间:2023-11-28 06:26:02 25 4
gpt4 key购买 nike

您好,我是 IOS Swift 开发的初学者,我只想知道是什么原因导致这些错误

由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“似乎没有有效的已编译 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

这是触发错误的代码块

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

我检查了 viewcontroller 标识符,它正是“vcEntry”,现在我知道这会触发错误,因为它是 collectionview 单元格的一部分,它会在我第三次选择/点击后触发,然后我返回到带有 collection view 的 View 细胞

最佳答案

你检查过这段代码有异常断点吗?如果不是,那么请添加一个异常断点并检查是否是这段代码导致崩溃。

当您的 XIB 未正确连接到您的 UIViewController 时,通常会发生这种类型的崩溃。

同时在 EntryViewController 中的 viewDidLoad 事件上添加一个断点,并检查您的 EntryViewController 是否正确推送到 Navigationbar 或不请让我知道。

关于ios - swift UINib 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41869778/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com