0

我正在使用 ABCustomUINavigationController ,我想像这样初始化我的故事板,但我总是得到错误

LoginViewController *loginViewController = [[LoginViewController alloc] init] ;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    } else {
        loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewControllerPad" bundle:nil];
    }

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    //self.window.rootViewController = [[FlipSquaresNavigationController alloc] initWithRootViewController:self.viewController];
    self.window.rootViewController = [[FlipSquaresNavigationController alloc] initWithRootViewController:loginViewController];
    [self.window makeKeyAndVisible];

再试一次

    NSString *nibName = [[NSString alloc] init] ;
    NSString *storyBoard = [[NSString alloc] init] ;

    if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
        //iPad
        nibName = @"LoginViewControllerPad" ;
        storyBoard = @"Main_iPad" ;
    }else {
        //iPhone
        nibName = @"LoginViewController" ;
        storyBoard = @"Main_iPhone" ;
    }

//    UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:storyBoard bundle: nil];
    LoginViewController *loginViewController = (LoginViewController *)[mainStoryboard instantiateViewControllerWithIdentifier: nibName];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    //self.window.rootViewController = [[FlipSquaresNavigationController alloc] initWithRootViewController:self.viewController];
    self.window.rootViewController = [[FlipSquaresNavigationController alloc] initWithRootViewController:loginViewController];
2014-04-22 19:13:27.744 匹配 [791:60b] 我 restkit:RKLog.m:33 RestKit 日志记录已初始化...
2014-04-22 19:13:28.218 匹配 [791:60b] *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法在包中加载 NIB:“NSBundle(已加载)”,名称为“LoginViewController” '
*** 首先抛出调用堆栈:
(0x2f457f4b 0x397e76af 0x2f457e8d 0x31f29e39 0x31e8b917 0x31ced389 0x31bcf1bd 0x31bcf139 0x31c46dd5 0x31c4574d 0x31c4529b 0x31c45223 0x31c451bb 0x31c3dcb9 0x31bd0db7 0x31c44f09 0x31c449d5 0x31bd5f95 0x31bd34db 0x31c3e08d 0x91e29 0x31c3b2ff 0x31c3ad4f 0x31c35353 0x31bd041f 0x31bcf721 0x31c34b3d 0x3406b70d 0x3406b2f7 0x2f4229df 0x2f42297b 0x2f42114f 0x2f38bc27 0x2f38ba0b 0x31c33dd9 0x31c2f049 0xbc49d 0x39cefab7)
libc++abi.dylib:以 NSException 类型的未捕获异常终止
(lldb)
4

0 回答 0