2016-11-22 35 views
0

編輯: 人們downvoting是因爲我使用的睡眠,這就是爲什麼我用它:的AppDelegate「意外零窗口」錯誤

Making the launch image display longer xcode

窗口大小小。如果你不這樣做。要回答,不要downvote它。 我只是想擺脫這種錯誤的。

unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: UIClassicWindow: ; frame = (0 0; 320 568); userInteractionEnabled = NO; gestureRecognizers = NSArray: > ; layer = UIWindowLayer: >>


我有一個iOS應用程序,可以在橫向模式下在iPad和iPhone上運行。它運行在iPad模擬器但在iPhone 5S和iPhone 6S(這是我迄今已檢測)的罰款,我得到這個錯誤:

unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: UIClassicWindow: ; frame = (0 0; 320 568); userInteractionEnabled = NO; gestureRecognizers = NSArray: > ; layer = UIWindowLayer: >>

這是AppDelegate的代碼..我沒有任何問題在ipad上。

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

// [NSThread sleepForTimeInterval:3]; 

    [application setStatusBarHidden:YES]; 
    self.window = [UIWindow new];  

    if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { 

     self->_loginViewController = [[LoginViewController alloc] initWithNibName:@"somename~ipad" bundle:nil]; 

    } else if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { 

     self->_loginViewController = [[LoginViewController alloc] initWithNibName:@"somename~iphone" bundle:nil]; 
    } 

    [[NSUserDefaults standardUserDefaults] setValue:@(NO) forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"]; 

    self.window.rootViewController = nil; 
    self.window.rootViewController = self->_loginViewController; 

    [[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]]; 
    [[UINavigationBar appearance] setTranslucent:NO]; 

    [self.window makeKeyAndVisible]; 
    [self.window setFrame:[[UIScreen mainScreen] bounds]]; 
    return YES; 
} 
+0

永眠在主線程上。 – rmaddy

+0

看到這個http://stackoverflow.com/questions/25963101/unexpected-nil-window-in-uiapplicationhandleeventfromqueueevent –

+0

@rmaddy我有一個啓動圖像。我希望它顯示3秒鐘,所以我把它。 – Swift

回答