发布iOS应用遇UIInterfaceOrientation配置错误,寻求技术帮助
解决iOS应用发布时的UISupportedInterfaceOrientations配置错误
问题原因
苹果要求支持iPad多任务的应用,UISupportedInterfaceOrientations必须包含全部四个屏幕方向,仅配置竖屏会触发包验证失败。
解决步骤
方法1:通过Xcode可视化界面修改
- 打开项目的
Info.plist文件(Xcode中显示为"Info"标签页) - 找到
Supported interface orientations (iPad)条目 - 点击右侧加号按钮,依次添加以下四个方向:
Portrait (bottom home button)Portrait (top home button)Landscape (left home button)Landscape (right home button)
方法2:手动编辑Info.plist源码
- 右键点击
Info.plist文件,选择「Open As」→「Source Code」 - 找到或添加
<key>UISupportedInterfaceOrientations~ipad</key>对应的数组节点,替换为以下代码:
<key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array>
可选:关闭iPad多任务支持(不推荐)
如果你的应用无需适配iPad多任务功能,可通过以下操作规避该要求:
- 在
Info.plist中添加UIRequiresFullScreen键,设置其值为YES(Xcode可视化界面中对应「Requires full screen」选项,勾选即可)。此设置会禁用iPad的分屏、滑过等多任务功能。
内容的提问来源于stack exchange,提问作者aycha
相关产品推荐
相关产品推荐

