iOS 9:警告“;除非应用程序需要全屏显示,否则必须支持所有界面方向;通用应用程序

iOS 9:警告“;除非应用程序需要全屏显示,否则必须支持所有界面方向;通用应用程序,ios,iphone,xcode,ipad,multitasking,Ios,Iphone,Xcode,Ipad,Multitasking,我正在开发一个通用的应用程序,在iPad上有所有方向,在iPhone上只有肖像。该应用程序在兼容iOS 9的iPad上可以很好地进行分屏多任务处理,但我有一个警告: All interface orientations must be supported unless the app requires full screen 我的应用不需要全屏。它仅限于iPhone上的肖像。。。难道不应该吗?有没有办法声明iPhone只需要全屏 提前谢谢 顺便说一下,我在Info.plist中使用Xcode

我正在开发一个通用的应用程序,在iPad上有所有方向,在iPhone上只有肖像。该应用程序在兼容iOS 9的iPad上可以很好地进行分屏多任务处理,但我有一个警告:

All interface orientations must be supported unless the app requires full screen
我的应用不需要全屏。它仅限于iPhone上的肖像。。。难道不应该吗?有没有办法声明iPhone只需要全屏

提前谢谢


顺便说一下,我在Info.plist中使用Xcode 7.3.1将UIRequiresFullScreen设置为YES


享受

事实上,这太容易了。。。这就是为什么我没有试过的原因:

设备方向设置
纵向
,不会影响iPad方向

这意味着设备方向部分应该改名为iPhone方向,事实上,在这种配置下,iPhone只支持
纵向
,而iPad支持所有这些。而且分割屏幕仍然是允许的,因为我们没有选中
需要全屏


PS:至少在Xcode 8.3.1上,我还没有在Xcode 7.x上测试过它。解决方法是使用“设备特定键”:

因此,您的plist值将类似于:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiresFullScreen~ipad</key>
<false/>
UI支持接口方向
UIInterfaceOrientationPortrait
UIInterfaceOrientation上下方向图
UI支持界面方向~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientation上下方向图
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
UIRequiresFullScreen
UIRequiresFullScreen~ipad
当我删除iPad特定版本的
UIRequiresFullScreen
键时,我就失去了全屏幕分割功能-只有“幻灯片”可用,因为这不会影响我的应用程序对整个设备屏幕的使用

“设备方向”复选框用于默认plist值。它们不会影响iPad上的应用程序的唯一方法是,如果plist中有一个更具体的值,那么这个值就是专门针对iPad的

系统在应用程序的Info.plist文件中搜索密钥时,会选择最特定于当前设备和平台的密钥


对于您的情况,您可以使用:UISupportedInterfaceOrientations~iphone

将Info.plist中的UISupportedInterfaceOrientations部分更改为:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
UI支持接口方向
UIInterfaceOrientationPortrait
UIInterfaceOrientation上下方向图
UIInterface方向和左视图
UIInterfaceOrientationAndscapeRight
UI支持接口方向~iphone
UIInterfaceOrientationPortrait

此组合不会产生警告。

从首选项转到“位置”选项卡,找到项目的衍生数据文件夹,并删除与项目相关的文件。

此anwser可以帮助你。不幸的是,我需要该应用程序在iPad上支持分屏,但在iPhone上仅支持肖像…不,因为我需要分屏。但是谢谢你的回答。你确定这是正确的吗?您可能会发现plist中有一个特定于iPad版本的
ui支持界面方向键。有关详细信息,请参见我的答案。事实上,iPad专用键现在直接在
info.plist
中设置。因此,即使您的解决方案更精确,这一解决方案仍然有效(至少在新项目上)。这是正确的答案-另外一点:您可以为iPhone定义一组简化的支持方向,并允许所有iPad与splitview兼容