2016-03-02 77 views
0

我正在为一个项目制作一个应用程序,该项目显示歌曲标题表,并允许您单击它们以查看有关它的更多详细信息。该项目的名称是SpinCity。错误 - 线程1:信号SIGABRT SpinCity

下面是线程异常错误:

// main.m 
// SpinCity 

#import <UIKit/UIKit.h> 
#import "AppDelegate.h" 

int main(int argc, char *argv[]) 
{ 
    @autoreleasepool { 
     return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 
    } 
} 

控制台输出为:

2016-03-02 11:25:15.036 SpinCity[32877:2988350] -[MasterViewController topViewController]: unrecognized selector sent to instance 0x7f975a6a47d0 
2016-03-02 11:25:15.038 SpinCity[32877:2988350] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MasterViewController topViewController]: unrecognized selector sent to instance 0x7f975a6a47d0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010712de65 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000106ba6deb objc_exception_throw + 48 
    2 CoreFoundation      0x000000010713648d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
    3 CoreFoundation      0x000000010708390a ___forwarding___ + 970 
    4 CoreFoundation      0x00000001070834b8 _CF_forwarding_prep_0 + 120 
    5 SpinCity       0x00000001066a0acb -[AppDelegate application:didFinishLaunchingWithOptions:] + 235 
    6 UIKit        0x00000001074d11f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272 
    7 UIKit        0x00000001074d2397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415 
    8 UIKit        0x00000001074d8cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760 
    9 UIKit        0x00000001074d5e7b -[UIApplication workspaceDidEndTransaction:] + 188 
    10 FrontBoardServices     0x0000000109ea9754 -[FBSSerialQueue _performNext] + 192 
    11 FrontBoardServices     0x0000000109ea9ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 
    12 CoreFoundation      0x0000000107059a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    13 CoreFoundation      0x000000010704f95c __CFRunLoopDoSources0 + 556 
    14 CoreFoundation      0x000000010704ee13 __CFRunLoopRun + 867 
    15 CoreFoundation      0x000000010704e828 CFRunLoopRunSpecific + 488 
    16 UIKit        0x00000001074d57cd -[UIApplication _run] + 402 
    17 UIKit        0x00000001074da610 UIApplicationMain + 171 
    18 SpinCity       0x00000001066a1fff main + 111 
    19 libdyld.dylib      0x000000010986992d start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

的任何想法如何解决这个问题?

谢谢。

+0

停止调用'[MasterViewController topViewController]'。 – trojanfoe

+1

'topViewController'方法是为'UINavigationController'定义的,但它看起来像'MasterViewController'不是其中之一。 –

回答

0

很清楚为何导致崩溃:

' - [MasterViewController topViewController]:无法识别的选择发送到实例0x7f975a6a47d0' ***第一掷调用堆栈:

而且调用堆栈显示,您正试图在您的application:didFinishLaunchingWithOptions:方法中调用该方法。