在iPhone中无法理解exception

嘿,任何人都可以帮助我,我之前的代码和链接是什么类型的例外: 应用程序在模拟器上运行但不在iphone设备上运行

谁可以在这里告诉谁有什么类型的例外? 有内存泄漏吗?

这是下面的日志:

2013-12-27 17:53:26.814 Skirr[1346:a0b] Application windows are expected to have a root view controller at the end of application launch 2013-12-27 17:53:27.995 Skirr[1346:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' *** First throw call stack: ( 0 CoreFoundation 0x032745e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x021b88b6 objc_exception_throw + 44 2 CoreFoundation 0x03228316 -[__NSPlaceholderArray initWithObjects:count:] + 390 3 CoreFoundation 0x0324bce9 +[NSArray arrayWithObject:] + 73 4 Skirr 0x000093bd -[SlideViewController viewDidLoad] + 1597 5 UIKit 0x00e2d318 -[UIViewController loadViewIfRequired] + 696 6 UIKit 0x00e2d5b4 -[UIViewController view] + 35 7 UIKit 0x00e473e2 -[UINavigationController _startCustomTransition:] + 778 8 UIKit 0x00e540c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688 9 UIKit 0x00e54cb9 -[UINavigationController __viewWillLayoutSubviews] + 57 10 UIKit 0x00f8e181 -[UILayoutContainerView layoutSubviews] + 213 11 UIKit 0x00d84267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 12 libobjc.A.dylib 0x021ca81f -[NSObject performSelector:withObject:] + 70 13 QuartzCore 0x005622ea -[CALayer layoutSublayers] + 148 14 QuartzCore 0x005560d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 15 QuartzCore 0x00555f40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 16 QuartzCore 0x004bdae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 17 QuartzCore 0x004bee71 _ZN2CA11Transaction6commitEv + 393 18 QuartzCore 0x004bf544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 19 CoreFoundation 0x0323c4ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 20 CoreFoundation 0x0323c41f __CFRunLoopDoObservers + 399 21 CoreFoundation 0x0321a344 __CFRunLoopRun + 1076 22 CoreFoundation 0x03219ac3 CFRunLoopRunSpecific + 467 23 CoreFoundation 0x032198db CFRunLoopRunInMode + 123 24 GraphicsServices 0x034ce9e2 GSEventRunModal + 192 25 GraphicsServices 0x034ce809 GSEventRun + 104 26 UIKit 0x00d19d3b UIApplicationMain + 1225 27 Skirr 0x000055a2 main + 130 28 libdyld.dylib 0x06896725 start + 0 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) 

看看这个链接

尝试从对象[0]插入nil对象

您正在插入或处理nil对象,您可以在上面的链接中获得该行参考

错误

*由于未捕获的exception’NSInvalidArgumentException’终止应用程序,原因:’* – [__ NSPlaceholderArray initWithObjects:count:]:尝试从对象[0]中插入nil对象

正在发生,因为您正在尝试将nil值添加到NSArray 。 在另一个问题上查看代码后,它崩溃的特定代码行是

 [_slideNavigationController setViewControllers:[NSArray arrayWithObject:initalViewController] animated:NO]; 

由于两件事之一,它在这里崩溃

1) initalViewControllernil所以当你使用arrayWithObject添加它时它会崩溃。

要么

2) setViewControllers:[NSArray arrayWithObject:initalViewController]导致错误,因为[NSArray arrayWithObject:initalViewController]nil设置为接受NSArray的方法setViewControllers:方法。

我会说它是选项(1)导致你的问题,因为当调用arrayWithObject时发生崩溃。

检查你的main.m. 最后一个参数应设置为实现UIApplicationDelegate协议的类的名称,或者您可以尝试最后一个参数,如NSStringFromClass([AppDelegate class])

请检查此链接,它可能会对您有所帮助。 点击这里