2016-11-22 9 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: >>


私は風景モードでiPadとiPhoneの両方で動作するiOSアプリを持っています。 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

答えて

0

ランドスケープアプリケーションにアセットカタログを使用していたため、「予期しないnilウィンドウ」エラーが発生していることがわかりました。

https://developer.apple.com/library/content/technotes/tn2244/_index.html#//apple_ref/doc/uid/DTS40009012

Avoid using asset catalogs to manage the launch images of landscape applications. Except for launch images used by the iPhone 6 Plus, asset catalogs assume that all iPhone launch images are for the portrait orientation.

関連する問題