我的应用程序崩溃是因为SIGABRT发生了

时间:2013-12-14 06:19:20

标签: ios objective-c ios7 uitabbarcontroller sigabrt

我使用了Apple示例文件的“详细信息 - 主应用程序”。

我编辑了'Main-iPhone.storyboard',就像这张图片一样。

Main-iPhone.storyboard

我的申请发生了这个错误。

2013-12-14 15:13:12.960 IFST[2448:70b] -[UITabBarController topViewController]: unrecognized selector sent to instance 0x8a6c290
2013-12-14 15:13:12.963 IFST[2448:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController topViewController]: unrecognized selector sent to instance 0x8a6c290'
*** First throw call stack:
(
    0   CoreFoundation                      0x01aa15e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x018248b6 objc_exception_throw + 44
    2   CoreFoundation                      0x01b3e903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x01a9190b ___forwarding___ + 1019
    4   CoreFoundation                      0x01a914ee _CF_forwarding_prep_0 + 14
    5   IFST                                0x00004d40 -[AppDelegate application:didFinishLaunchingWithOptions:] + 848
    6   UIKit                               0x0058c355 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
    7   UIKit                               0x0058cb95 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
    8   UIKit                               0x005913a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    9   UIKit                               0x005a587c -[UIApplication handleEvent:withNewEvent:] + 3447
    10  UIKit                               0x005a5de9 -[UIApplication sendEvent:] + 85
    11  UIKit                               0x00593025 _UIApplicationHandleEvent + 736
    12  GraphicsServices                    0x039042f6 _PurpleEventCallback + 776
    13  GraphicsServices                    0x03903e01 PurpleEventCallback + 46
    14  CoreFoundation                      0x01a1cd65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    15  CoreFoundation                      0x01a1ca9b __CFRunLoopDoSource1 + 523
    16  CoreFoundation                      0x01a4777c __CFRunLoopRun + 2156
    17  CoreFoundation                      0x01a46ac3 CFRunLoopRunSpecific + 467
    18  CoreFoundation                      0x01a468db CFRunLoopRunInMode + 123
    19  UIKit                               0x00590add -[UIApplication _run] + 840
    20  UIKit                               0x00592d3b UIApplicationMain + 1225
    21  IFST                                0x0000592d main + 141
    22  libdyld.dylib                       0x020df70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

和SIGABRT。

为什么会这样?

请告诉我。

1 个答案:

答案 0 :(得分:0)

您的崩溃日志为您提供答案:

2013-12-14 15:13:12.963 IFST[2448:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController topViewController]: unrecognized selector sent to instance 0x8a6c290'

您正在向标签栏控制器发送topViewController。它不是导航控制器,因此这种方法不合适。也许selectedViewController是您正在寻找的那个。