Ios UIApplicationInvalidInterfaceOrientation preferredInterfaceOrientationForPresentation必须返回支持的接口方向
下面是我的示例代码Ios UIApplicationInvalidInterfaceOrientation preferredInterfaceOrientationForPresentation必须返回支持的接口方向,ios,objective-c,Ios,Objective C,下面是我的示例代码 Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!' *** First throw call stack: ( 0 CoreFoundation
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'
*** First throw call stack:
(
0 CoreFoundation 0x0000000110849c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001104e2bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000110849b9d +[NSException raise:format:] + 205
3 UIKit 0x0000000110d8713c -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 487
4 UIKit 0x00000001112ffa6b -[_UIFullscreenPresentationController _adjustOrientationIfNecessaryInWindow:forViewController:preservingViewController:] + 330
5 UIKit 0x0000000110d4ed37 -[UIPresentationController _presentWithAnimationController:interactionController:target:didEndSelector:] + 707
6 UIKit 0x0000000110d7e576 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 756
7 UIKit 0x0000000110d7f76e -[UIViewController _presentViewController:withAnimationController:completion:] + 3079
8 UIKit 0x0000000110d816c1 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 132
9 UIKit 0x0000000110d815e5 -[UIViewController presentViewController:animated:completion:] + 229
10 redminete 0x000000010ff92a11 -[LoginViewController btnsingin:] + 1537
11 UIKit 0x0000000110c43d62 -[UIApplication sendAction:to:from:forEvent:] + 75
12 UIKit 0x0000000110d5550a -[UIControl _sendActionsForEvents:withEvent:] + 467
13 UIKit 0x0000000110d548d9 -[UIControl touchesEnded:withEvent:] + 522
14 UIKit 0x0000000110c90958 -[UIWindow _sendTouchesForEvent:] + 735
15 UIKit 0x0000000110c91282 -[UIWindow sendEvent:] + 682
16 UIKit 0x0000000110c57541 -[UIApplication sendEvent:] + 246
17 UIKit 0x0000000110c64cdc _UIApplicationHandleEventFromQueueEvent + 18265
18 UIKit 0x0000000110c3f59c _UIApplicationHandleEventQueue + 2066
19 CoreFoundation 0x000000011077d431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x00000001107732fd __CFRunLoopDoSources0 + 269
21 CoreFoundation 0x0000000110772934 __CFRunLoopRun + 868
22 CoreFoundation 0x0000000110772366 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x0000000113d6fa3e GSEventRunModal + 161
24 UIKit 0x0000000110c428c0 UIApplicationMain + 1282
25 redminete 0x000000010ff9bd93 main + 99
26 libdyld.dylib 0x0000000112ded145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
如何解决此问题。您是否尝试在此处查看:?我有以下用户代码。但不起作用-(BOOL)应该自动旋转{return NO;}-(NSUInteger)支持的接口方向{return ui接口方向askportrait;}-(ui接口方向)首选接口方向进行演示{return ui接口方向肖像;}尝试这个-(BOOL)应该自动旋转{return YES;}它不工作返回YES.error Occurse行[self-presentViewController:tabBar animated:YES completion:Nil];
- (IBAction)btnsingin:(id)sender {
NSString * storyboardName=@"Main";
UIStoryboard *storyboard =[UIStoryboard storyboardWithName:storyboardName bundle:nil];
UITabBarController *tabBar =[storyboard instantiateViewControllerWithIdentifier:@"MainTabBar"];
[self presentViewController:tabBar animated:YES completion:Nil];
}