繁体   English   中英

在视图控制器之间切换时发生崩溃错误

[英]Crash error when switching between view controllers

在视图控制器之间切换时出现错误。 使用情节提要通过segues进行切换。 有趣的是,如果我从ViewController A切换到B,然后又快速返回,则一切正常。 如果我从ViewController A切换到B,然后等待20秒,然后尝试切换回ViewController A,则我的应用程序因以下错误而崩溃:

'NSInternalInconsistencyException',原因:'无法在名称为'2-view-3'且目录为'MainStoryboard_iPhone.storyboardc'的捆绑软件:'NSBundle(loaded)'中加载NIB”

要添加的两件事1.我正在使用没有nib或xib文件的情节提要2.我有MainStoryboard_iPhone.storyboard文件(它在错误消息中显示的末尾没有'c')。

任何帮助表示赞赏。 这是完整的错误输出:

> *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in
> bundle: 'NSBundle </Users/myname/Library/Application Support/iPhone
> Simulator/7.0.3/Applications/73FBEFE1-C31E-499C-9084-2B8B284EA5E7/myapp.app>
> (loaded)' with name 'Bkf-UI-YhZ-view-Nrc-eq-8MI' and directory
> 'MainStoryboard_iPhone.storyboardc''
> *** First throw call stack: (     0   CoreFoundation                      0x024135e4 __exceptionPreprocess + 180  1   libobjc.A.dylib           
> 0x01bf68b6 objc_exception_throw + 44  2   CoreFoundation              
> 0x024133bb +[NSException raise:format:] + 139     3   UIKit              
> 0x009f839c -[UINib instantiateWithOwner:options:] + 951   4   UIKit    
> 0x0086a605 -[UIViewController _loadViewFromNibNamed:bundle:] + 280    5 
> UIKit                               0x0086adad -[UIViewController
> loadView] + 302   6   UIKit                               0x0086b0ae
> -[UIViewController loadViewIfRequired] + 78   7   UIKit                               0x0086b5b4 -[UIViewController view] + 35    8   UIKit                   
> 0x0087a361 -[UIViewController viewControllerForRotation] + 63     9  
> UIKit                               0x00871f00 -[UIViewController
> _visibleView] + 84    10  UIKit                               0x0087b2f0 -[UIViewController rotatingContentViewForWindow:] + 33   11  UIKit                               0x00bbfa03 -[UIClientRotationContext
> initWithClient:toOrientation:duration:andWindow:] + 327   12  UIKit    
> 0x0079b2f2 -[UIWindow
> _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:]
> + 1495    13  UIKit                               0x00aff7b9 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]
> + 2798    14  UIKit                               0x008770fc -[UIViewController presentViewController:withTransition:completion:] + 6433  15  UIKit                               0x0087761f
> -[UIViewController presentViewController:animated:completion:] + 130  16  UIKit                               0x0087765f -[UIViewController
> presentModalViewController:animated:] + 56    17  UIKit                 
> 0x00c9be16 -[UIStoryboardModalSegue perform] + 271    18  UIKit         
> 0x00c8c07e -[UIStoryboardSegueTemplate _perform:] + 174   19  UIKit    
> 0x00c8c0f9 -[UIStoryboardSegueTemplate perform:] + 115    20 
> libobjc.A.dylib                     0x01c08874 -[NSObject
> performSelector:withObject:withObject:] + 77  21  UIKit               
> 0x007590c2 -[UIApplication sendAction:to:from:forEvent:] + 108    22 
> UIKit                               0x00a2dc9b
> -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139   23  libobjc.A.dylib                     0x01c08874 -[NSObject
> performSelector:withObject:withObject:] + 77  24  UIKit               
> 0x007590c2 -[UIApplication sendAction:to:from:forEvent:] + 108    25 
> UIKit                               0x0075904e -[UIApplication
> sendAction:toTarget:fromSender:forEvent:] + 61    26  UIKit             
> 0x008510c1 -[UIControl sendAction:to:forEvent:] + 66  27  UIKit       
> 0x00851484 -[UIControl _sendActionsForEvents:withEvent:] + 577    28 
> UIKit                               0x00850733 -[UIControl
> touchesEnded:withEvent:] + 641    29  UIKit                             
> 0x0079651d -[UIWindow _sendTouchesForEvent:] + 852    30  UIKit         
> 0x00797184 -[UIWindow sendEvent:] + 1232  31  UIKit                   
> 0x0076ae86 -[UIApplication sendEvent:] + 242  32  UIKit               
> 0x0075518f _UIApplicationHandleEventQueue + 11421     33  CoreFoundation 
> 0x0239c83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
> + 15  34  CoreFoundation                      0x0239c1cb __CFRunLoopDoSources0 + 235  35  CoreFoundation                      0x023b929e __CFRunLoopRun + 910     36  CoreFoundation                   
> 0x023b8ac3 CFRunLoopRunSpecific + 467     37  CoreFoundation             
> 0x023b88db CFRunLoopRunInMode + 123   38  GraphicsServices             
> 0x031f79e2 GSEventRunModal + 192  39  GraphicsServices                
> 0x031f7809 GSEventRun + 104   40  UIKit                              
> 0x00757d3b UIApplicationMain + 1225   41  myapp                 
> 0x0000298d main + 141     42  libdyld.dylib                      
> 0x03ddb70d start + 1 ) libc++abi.dylib: terminating with uncaught
> exception of type NSException

确保您在以下方法中加载任何与视图相关的内容,例如self.tableView ,这会导致不一致。

-(id)initWithCoder:(NSCoder *)aDecoder

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM