因未捕获的异常终止应用程序' NSInternalInconsistencyException'和线程1:信号SIGABRT

时间:2016-01-14 11:24:02

标签: ios objective-c swift

我是IOS的新手(Swift)我有一个旧的Objective-c项目。当我运行项目时,它显示构建成功,然后发生跟随错误。并自动进入main.m文件。我尝试根据thisthis帖子解决此问题。我想要了解但没有获得成功。请任何人建议我做什么?

2016-01-14 15:49:09.458 Cube-Menu[658:19068] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.16.3/UIApplication.m:3294
2016-01-14 15:49:09.461 Cube-Menu[658:19068] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
    0   CoreFoundation                      0x022daaa4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x01d99e02 objc_exception_throw + 50
    2   CoreFoundation                      0x022da93a +[NSException raise:format:arguments:] + 138
    3   Foundation                          0x018130a6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
    4   UIKit                               0x002f15cb -[UIApplication _runWithMainScene:transitionContext:completion:] + 3674
    5   UIKit                               0x003152f5 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3206 + 68
    6   UIKit                               0x002edc11 -[UIApplication workspaceDidEndTransaction:] + 163
    7   FrontBoardServices                  0x060fbccc __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    8   FrontBoardServices                  0x060fb7a3 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    9   FrontBoardServices                  0x061191cb -[FBSSerialQueue _performNext] + 184
    10  FrontBoardServices                  0x06119602 -[FBSSerialQueue _performNextFromRunLoopSource] + 52
    11  FrontBoardServices                  0x061188fe FBSSerialQueueRunLoopSourceHandler + 33
    12  CoreFoundation                      0x021f4d3f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    13  CoreFoundation                      0x021ea9cb __CFRunLoopDoSources0 + 523
    14  CoreFoundation                      0x021e9de8 __CFRunLoopRun + 1032
    15  CoreFoundation                      0x021e9726 CFRunLoopRunSpecific + 470
    16  CoreFoundation                      0x021e953b CFRunLoopRunInMode + 123
    17  UIKit                               0x002ed4fa -[UIApplication _run] + 540
    18  UIKit                               0x002f2d24 UIApplicationMain + 160
    19  Cube-Menu                           0x00009f6f main + 127
    20  libdyld.dylib                       0x03a8ca21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

AppDelegate文件

#import "AYHAppDelegate.h"
#import "AUICubeMenu.h"
@implementation AYHAppDelegate
- (void)dealloc
{
    [_window release];
    [super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    AUICubeMenu *cubeMenu = [[AUICubeMenu alloc] initWithFrame:CGRectMake(110.0, 100.0, 100.0, 100.0)];
    [self.window addSubview:cubeMenu];
    [cubeMenu release];

    [self.window makeKeyAndVisible];
    return YES;
}

main.m文件

#import <UIKit/UIKit.h>
#import "AYHAppDelegate.h"
int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AYHAppDelegate class]));
    }
}

And also shows following

Thread 1: signal SIGABRT

error on this line 

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AYHAppDelegate class]));

0 个答案:

没有答案