Objective c 设置RootViewController时ios8中的方向问题

Objective c 设置RootViewController时ios8中的方向问题,objective-c,iphone,xcode6,orientation,ios8.1,Objective C,Iphone,Xcode6,Orientation,Ios8.1,我正在开发一个应用程序,其中我将rootViewController设置为 if(token){ UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController* viewController = [

我正在开发一个应用程序,其中我将rootViewController设置为

 if(token){
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    UIViewController* viewController = [sb instantiateViewControllerWithIdentifier:@"Home"];
    UINavigationController *navigationController = [[UINavigationController alloc]
                                                    initWithRootViewController:viewController];
    [navigationController setNavigationBarHidden:YES animated:NO];
    self.window = [[UIWindow alloc]
                   initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window makeKeyAndVisible];
    [self.window setRootViewController:navigationController];
  }
当这段代码工作时,方向工作不正常,状态栏会旋转,但视图保持不变

这在iOS7.1及以下版本中非常有效,但当它在iOS8.1上运行时,我们会遇到这个问题