【发布时间】:2015-03-06 17:19:42
【问题描述】:
我已经阅读了很多关于这个问题的答案,但似乎没有一个与我的问题有关。
我有两个视图,视图 1 有一个按钮。视图 2 有一个按钮。
View 1 按钮绑定到 View 2 的模型 segue。
我单击视图 1 中的按钮,它会打开视图 2。
在视图 2 中,按钮连接到触发的 IBAction
[self dismissViewControllerAnimated:YES completion:nil];
关闭视图并再次显示视图 1 - 现在如果我再次按下视图 1 上的按钮,我会得到
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle <x/y/z/SomeApp.app> (loaded)' with name 'tvz-Io-ndz-view-rB8-bq-l6j' and directory 'Main.storyboardc''
我完全不知道如何解决这个问题。请帮忙!
编辑:
- 仅当设备没有互联网时才会发生这种情况
- 如果链中的第三个屏幕带有呈现图像的 web 视图,如果我从视图 2 转到该屏幕,则应用不会崩溃。
编辑 2:
我也尝试过从头开始重建屏幕。
我完全糊涂了。
编辑 3:完整堆栈跟踪
2015-01-19 09:10:58.528 SomeApp[37747:2203364] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason: 'Could not
load NIB in bundle: 'NSBundle
</Users/user/Library/Developer/CoreSimulator/Devices/D23C1B7C-7330-
466E-8369-762C6727B19C/data/Containers/Bundle/Application/AE67C3D3-C5AE-
4A66-91EC-54D976A4A4FC/SomeApp.app> (loaded)' with name 'tvz-Io-ndz-view-
rB8-bq-l6j' and directory 'Main.storyboardc''
*** First throw call stack:
(
0 CoreFoundation 0x01f64946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01beda97 objc_exception_throw + 44
2 CoreFoundation 0x01f6486d +[NSException raise:format:] + 141
3 UIKit 0x008f8e06 -[UINib instantiateWithOwner:options:] + 1003
4 UIKit 0x0071b624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
5 UIKit 0x0071bdbb -[UIViewController loadView] + 295
6 UIKit 0x0071bfef -[UIViewController loadViewIfRequired] + 78
7 UIKit 0x0071c595 -[UIViewController view] + 35
8 UIKit 0x00d8f707 -[_UIFullscreenPresentationController _setPresentedViewController:] + 75
9 UIKit 0x006f1a81 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 113
10 UIKit 0x00729a61 -[UIViewController _presentViewController:withAnimationController:completion:] + 2102
11 UIKit 0x0072c5d2 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 345
12 UIKit 0x0072c424 -[UIViewController presentViewController:animated:completion:] + 224
13 UIKit 0x0072c8ea -[UIViewController presentModalViewController:animated:] + 57
14 UIKit 0x00bf448d -[UIStoryboardModalSegue perform] + 271
15 UIKit 0x00be1b49 -[UIStoryboardSegueTemplate _perform:] + 217
16 UIKit 0x00be1bc5 -[UIStoryboardSegueTemplate perform:] + 116
17 UIKit 0x006d4907 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1490
18 UIKit 0x006d4af7 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 285
19 UIKit 0x006d9df3 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
20 UIKit 0x005ee0ce ___afterCACommitHandler_block_invoke + 15
21 UIKit 0x005ee079 _applyBlockToCFArrayCopiedToStack + 415
22 UIKit 0x005ede8e _afterCACommitHandler + 545
23 CoreFoundation 0x01e879de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x01e87920 __CFRunLoopDoObservers + 400
25 CoreFoundation 0x01e7d35a __CFRunLoopRun + 1226
26 CoreFoundation 0x01e7cbcb CFRunLoopRunSpecific + 443
27 CoreFoundation 0x01e7c9fb CFRunLoopRunInMode + 123
28 GraphicsServices 0x043d524f GSEventRunModal + 192
29 GraphicsServices 0x043d508c GSEventRun + 104
30 UIKit 0x005c48b6 UIApplicationMain + 1526
31 SomeApp 0x000e482d main + 141
32 libdyld.dylib 0x027e8ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
詹姆斯
【问题讨论】:
-
您能否展示呈现视图 2 的代码,以确保那里没有发生任何奇怪的事情?
-
@Stonz2 没有手写代码右键单击将按钮拖到第二视图并且没有任何额外的 Segue 处理代码。
-
view2 的“拆解”代码中缺少某些内容,某些进程您已启动但未正确清理。也许 view2 是某事的代表,并且有一个保留周期?以我的经验,只有在第一个 view2 没有正确发布时才会发生这种情况..
-
覆盖 view2 中的 dealloc 并设置断点。并且 viewWillDisappear 事件中的 dealloc 永远不会被调用(我提示它不是当你没有到达 view3 时)
-
谢谢@Jef 我明天回到办公室时会试一试。问题是为什么没有互联网功能的应用程序只会在设备上禁用互联网时崩溃? (如果设备上有互联网,它就可以正常工作)
标签: ios objective-c