2012-03-03 77 views
0

我最近將iPhone應用程序從xcode 3移植到xcode 4,並且出現SIGABRT錯誤。我已經找到了問題的行(這是註釋掉線 - >在我的應用程序委託執行):SIGABRT錯誤 - 將應用程序從xcode 3移植到xcode 4

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    // Override point for customization after application launch. 

    // Set the view controller as the window's root view controller and display. 
    self.window.rootViewController = self.viewController; 
    //navigationController = [[UINavigationController alloc] initWithRootViewController:self.window.rootViewController]; 
    navigationController.navigationBar.tintColor = [UIColor 
                 colorWithRed:217.0/255 
                 green:33.0/255 
                 blue:0 
                 alpha:1]; 
    navigationController.navigationBarHidden = YES; 
    [self.window addSubview:navigationController.view]; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

任何想法,爲什麼navigationController = [[UINavigationController alloc] initWithRootViewController:self.window.rootViewController];導致問題?

編輯:編譯器跳回主要方法並顯示sigabrt錯誤。

int main(int argc, char *argv[]) { 

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 
    int retVal = UIApplicationMain(argc, argv, nil, nil); //jumps to this line 
    [pool release]; 
    return retVal; 
} 

回答

0

你有什麼太大的意義。試試這個:

navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; 
self.window.rootViewController = navigationController; 

並刪除行[self.window addSubview:navigationController.view];

+0

它仍然無法正常工作 - 同樣的錯誤 – user559142 2012-03-03 22:01:39

+0

是否有任何記錄? – edc1591 2012-03-03 22:39:19