我已经对这个问题进行了大量的回答,但似乎没有一个与我的问题有关.
我有两个视图,视图1有一个按钮.视图2有一个按钮.
视图1按钮与模型segue绑定到视图2.
我单击视图1中的按钮,打开视图2.
在视图2中,按钮连接到发射的IBAction
[self dismissViewControllerAnimated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
这将关闭视图并再次显示视图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''
Run Code Online (Sandbox Code Playgroud)
我完全迷失了如何解决这个问题.请帮忙!
编辑:
编辑2:
我也试过从头开始重建屏幕.
我完全不知所措.
编辑3:完全Stacktrace
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
Run Code Online (Sandbox Code Playgroud)
詹姆士
Raz*_*van 30
可能有很多原因会导致您收到的错误.
我将开始列举一些要检查的内容和解决方案:
您是否在Xcode之外重命名了xib或storyboard文件?如果是这样,请检查您所引用的任何地方是否存在不一致.还要确保在引用文件的任何地方都要尊重大写/小写字母,因为区分大小写.
转到Interface Builder,选择View1 ViewController> Utilities Panel >> 如果你有一个(.h和.m文件),Identity Inspector检查它是否Custom Class对应你的ViewController类.
检查你的Info.plist文件.如果你使用storyboads,你应该有一个类似于Main storyboard file base nameNOT 的条目Main nib file base name.如果使用笔尖,则反之亦然.还要检查文件基名是否与实际文件的名称相对应.
检查目标Build Phases > Copy Bundle Resources并确保在那里添加了xib或storyboard文件.
如果以编程方式实例化View1 ViewController并使用xib文件检查错别字的笔尖名称(请记住,区分大小写).此外,如果您当前将.xib文件格式附加到名称,请删除该扩展名,因为它不应使用.我的意思是这行代码:UIViewController *controller = [[UIViewController alloc] initWithNibName:@"xibFileName" bundle:nil];
在文件检查器中检查xib或情节提要文件的属性,并确保在Target Membership选择面板中将文件链接到目标.
检查文件检查器中xib或情节提要文件的属性,然后尝试将文件切换Location为Relative to project或Relative to group.看看两种方式是否有所不同.
如果您以编程方式添加视图控制器,initWithCoder则应该在viewDidLoad方法中实例化它
如果上述情况不适用于您的情况,您可以从Xcode中删除该文件(选择Remove References)并在项目中再次导入该文件.
在进行上述更改后,请记住始终清理项目(SHIFT + COMMAND + K).
如果有效且有效,请告诉我们.
| 归档时间: |
|
| 查看次数: |
36933 次 |
| 最近记录: |