本文介绍了应用程序由于InterfaceOrientation而崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序基于 Landscape .当应用程序在我的设备上运行时,该应用程序立即崩溃.
My application is Landscape based. The app crashes immediately when the app runs on my device.
我选择了这两个字段
UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight我收到此错误:
由于未捕获的异常而终止应用程序UIApplicationInvalidInterfaceOrientation,原因:受支持方向与应用程序没有共同的方向,并且shouldAutorotate返回YES
Terminating app due to uncaught exception UIApplicationInvalidInterfaceOrientation, reason: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES
推荐答案向控制器添加 shouldAutorotate 和 supportedInterfaceOrientations 方法.
-(BOOL)shouldAutorotate { return YES; //this will auto-rotate the orientation. } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; // will force the app to load in landscape, you can change it as per your need. }更多推荐
应用程序由于InterfaceOrientation而崩溃
发布评论