57

I'm working on an universal app with all orientations on iPad and only portrait on iPhone. The app works well with split-screen multitasking on iOS 9 compatible iPad, but I have this warning:

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

And my app does not require full screen. It's only limited to portrait on iPhone... Shouldn't it be ok? Is there a way to declare Requires Full Screen only on iPhone?

Thanks in advance

By the way I'm using Xcode 7.3.1

Zaphod
  • 6,758
  • 3
  • 40
  • 60
  • this anwser can help u [http://stackoverflow.com/questions/33058829/updated-to-xcode-7-0-1-and-project-now-has-problems](http://stackoverflow.com/questions/33058829/updated-to-xcode-7-0-1-and-project-now-has-problems) – Renato Ioshida Nov 08 '16 at 12:28
  • 1
    Unfortunately I need the app to support split-screen on iPad but only portrait on iPhone... – Zaphod Nov 08 '16 at 16:01

5 Answers5

73

Set UIRequiresFullScreen to YES in Info.plist.

enter image description here

Enjoy...!!!

mital solanki
  • 2,394
  • 1
  • 15
  • 24
49

The solution to this is to use "Device Specific Keys": https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW9

Your plist values would therefore look something like:

<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/>

When I remove the iPad specific version of the UIRequiresFullScreen key, I lose the full split-screen functionality - only "slide over" is available because that doesn't affect my app's use of the full device screen.

The "Device Orientation" checkboxes are for the default plist values. The only way they wouldn't affect the app on the iPad is if there's a more specific value in the plist, therefore a value specifically for iPad.

When the system searches for a key in your app’s Info.plist file, it chooses the key that is most specific to the current device and platform.

siburb
  • 4,880
  • 1
  • 25
  • 34
  • this is the correct answer - one addition: you may define a reduced set of supported orientations for iphones and allow all for ipads to be compatible with splitview – iDoc Aug 20 '19 at 16:52
11

In fact, it was too easy... That's why I haven't even tried it:

Configuration

Setting Portrait for Device Orientation does not impact iPad orientation.

That means that the Device Orientation section should be renamed iPhone Orientation, indeed, with that configuration, the iPhone only supports Portrait and the iPad supports all of them. And the split-screen is still allowed as we have not checked Requires full screen.

PS: At least on Xcode 8.3.1, I have not tested it on Xcode 7.x

Zaphod
  • 6,758
  • 3
  • 40
  • 60
  • Are you sure this is correct? You'll probably find that there's an iPad specific version of the `UISupportedInterfaceOrientations` key in your plist. See my answer for details. – siburb Apr 26 '17 at 01:20
  • Indeed, the iPad specific keys are now set directly in the `info.plist`. So even if your solution is more precise, this one is still valid (at least on new projects) – Zaphod May 03 '17 at 15:29
2

For your case you can use: UISupportedInterfaceOrientations~iphone.

Change UISupportedInterfaceOrientations section in Info.plist to:

<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>

This combination produces no warnings.

tier777
  • 1,005
  • 12
  • 11
-5

Go to Locations tab from the Preferences, locate project's derived data folder, and delete files related to the project.

OrdoDei
  • 1,379
  • 2
  • 16
  • 9