'NSInternalInconsistencyException',原因:'无法在bundle中加载NIB

时间:2014-04-18 22:22:05

标签: ios objective-c cocoa-touch uistoryboard nib

我有一个引发错误的masterdetail应用程序;

Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Could not load NIB in bundle: 
'NSBundle </Users/Alex/Library/Application Support/iPhone Simulator/7.1/Applications/A301CCC3-21B3-4AB7-9209-72230036B148/EasyWake.app> (loaded)'
with name 'Ah7-4n-0Wa-view-MMQ-IT-qOo' and directory 'Main.storyboardc''

masterview包含一个以编程方式完全构建的tableview,一些单元格有按钮,uitextfields,或者是带有公开按钮的标准字幕单元格。

App按预期加载&amp;按预期运行几分钟,但之后如果我选择一行,应用程序将崩溃。

我无法弄清楚为什么会抛出这个错误;搜索SO并尝试其他解决方案,检查捆绑资源,我没有已知的泄漏或我所知道的未使用的阵列。如果有人能够对此有所了解,我们将不胜感激。

干杯,亚历克斯


错误Stacktrace;

*** First throw call stack:(
0   CoreFoundation                      0x018861e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x016058e5 objc_exception_throw + 44
2   CoreFoundation                      0x01885fbb +[NSException raise:format:] + 139
3   UIKit                               0x0057ab7b -[UINib instantiateWithOwner:options:] + 951
4   UIKit                               0x003e36f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
5   UIKit                               0x003e3e9d -[UIViewController loadView] + 302
6   UIKit                               0x003e40d3 -[UIViewController loadViewIfRequired] + 78
7   UIKit                               0x003e45d9 -[UIViewController view] + 35
8   UIKit                               0x003fe942 -[UINavigationController _startCustomTransition:] + 778
9   UIKit                               0x0040b8f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
10  UIKit                               0x0040c4e9 -[UINavigationController __viewWillLayoutSubviews] + 57
11  UIKit                               0x0054d0d1 -[UILayoutContainerView layoutSubviews] + 213
12  UIKit                               0x0af2521b -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
13  UIKit                               0x00334964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
14  libobjc.A.dylib                     0x0161782b -[NSObject performSelector:withObject:] + 70
15  QuartzCore                          0x0201145a -[CALayer layoutSublayers] + 148
16  QuartzCore                          0x02005244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17  QuartzCore                          0x020050b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18  QuartzCore                          0x01f6b7fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
19  QuartzCore                          0x01f6cb85 _ZN2CA11Transaction6commitEv + 393
20  QuartzCore                          0x01f6d258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
21  CoreFoundation                      0x0184e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
22  CoreFoundation                      0x0184e2bf __CFRunLoopDoObservers + 399
23  CoreFoundation                      0x0182c254 __CFRunLoopRun + 1076
24  CoreFoundation                      0x0182b9d3 CFRunLoopRunSpecific + 467
25  CoreFoundation                      0x0182b7eb CFRunLoopRunInMode + 123
26  GraphicsServices                    0x021b95ee GSEventRunModal + 192
27  GraphicsServices                    0x021b942b GSEventRun + 104
28  UIKit                               0x002c5f9b UIApplicationMain + 1225
29  EasyWake                            0x00010bfd main + 141
30  libdyld.dylib                       0x026b9701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

根据要求,选择ROW的代码;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.currentCell = indexPath;
switch ([indexPath section]) {
    case MACHINES:{
        if (self.WOLMachines.count <=0)return;
        self.wakeRequested = true;
        [self performSegueWithIdentifier:@"showDetail" sender:self];
        break;
    }

    case DISCOVEREDMACHINES:{
        if (self.DiscoveredMachines.count <=0)return;
        self.wakeRequested = true;
        [self performSegueWithIdentifier:@"showDetail" sender:self];
        break;
    }

    case ABOUT:
        NSLog(@"About Pressed");
        [self performSegueWithIdentifier:@"showInfo" sender:self];
        break;

    default:
        break;
}
}

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
self.currentCell = indexPath;
switch ([indexPath section]) {
    case MACHINES:{
        if (self.WOLMachines.count <=0)return;
        self.wakeRequested = false;
        [self performSegueWithIdentifier:@"showDetail" sender:self];
        break;
    }

    case DISCOVEREDMACHINES:{
        if (self.DiscoveredMachines.count <=0)return;
        self.wakeRequested = false;
        [self performSegueWithIdentifier:@"showDetail" sender:self];
        break;
    }

    case ABOUT:
        NSLog(@"About Pressed");
        [self performSegueWithIdentifier:@"showInfo" sender:self];
        break;

    default:
        break;
}

}

1 个答案:

答案 0 :(得分:0)

  
    

App按预期加载&amp;按预期运行几分钟,但之后如果我选择一行,应用程序将崩溃。

         

原因:&#39;无法在捆绑中加载NIB:

  
  1. 在执行SegueWithIdentifier时,让我们仔细检查名称:@&#34; showDetail&#34;。此名称与故事板中的名称相同

  2. 将所有异常翻转以捕获此错误。

  3. 希望这有帮助