2016-03-02 75 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:方法中調用該方法。