【问题标题】:iOS 9 : Warning "All interface orientations must be supported unless the app requires full screen" for universal appiOS 9:通用应用程序的警告“必须支持所有界面方向,除非应用程序需要全屏”
【发布时间】:2016-09-07 05:22:17
【问题描述】:

我正在开发一个在 iPad 上具有所有方向而在 iPhone 上仅纵向的通用应用程序。该应用程序在 iOS 9 兼容的 iPad 上与分屏多任务处理效果很好,但我有这个警告:

All interface orientations must be supported unless the app requires full screen

而且我的应用不需要全屏。只能在 iPhone 上拍人像……应该没问题吧?有没有办法在 iPhone 上声明需要全屏

提前致谢

顺便说一句,我使用的是 Xcode 7.3.1

【问题讨论】:

标签: ios iphone xcode ipad multitasking


【解决方案1】:

Info.plist 中将 UIRequiresFullScreen 设置为 YES

享受……!!!

【讨论】:

  • 不,因为我需要分屏可用。不过谢谢你的回答。
【解决方案2】:

其实太简单了...这就是为什么我什至没有尝试过:

设备方向 设置 Portrait 不会影响 iPad 方向。

也就是说Device Orientation部分应该重命名为iPhone Orientation,确实,在这样的配置下,iPhone只支持Portrait,iPad全都支持.而且分屏还是可以的,因为我们没有勾选Requires full screen

PS:至少在 Xcode 8.3.1 上,我还没有在 Xcode 7.x 上测试过

【讨论】:

  • 你确定这是正确的吗?您可能会发现您的 plist 中有一个 iPad 特定版本的 UISupportedInterfaceOrientations 键。详情见我的回答。
  • 确实,iPad 专用键现在直接在info.plist 中设置。所以即使你的解决方案更精确,这个仍然有效(至少在新项目上)
【解决方案3】:

解决方案是使用“设备特定键”: https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW9

因此,您的 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/>

当我删除 iPad 特定版本的 UIRequiresFullScreen 键时,我失去了完整的分屏功能 - 只有“滑过”可用,因为这不会影响我的应用程序对整个设备屏幕的使用。

“设备方向”复选框用于默认 plist 值。它们不会影响 iPad 上的应用的唯一方法是 plist 中有更具体的值,因此是专门针对 iPad 的值。

当系统在您应用的 Info.plist 文件中搜索密钥时,它会选择最适合当前设备和平台的密钥。

【讨论】:

  • 这是正确答案 - 一个补充:您可以为 iphone 定义一组简化的支持方向,并允许所有 ipad 与 splitview 兼容
【解决方案4】:

对于您的情况,您可以使用: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>

这种组合不会产生警告。

【讨论】:

    【解决方案5】:

    从 Preferences 转到 Locations 选项卡,找到项目的派生数据文件夹,然后删除与项目相关的文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-30
      • 1970-01-01
      • 2021-09-08
      • 2013-02-09
      • 2015-12-23
      • 2015-12-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多