Search code examples
iosios11xcode9iphone-x

Build app on Xcode 9 targeting iOS 11 but have compatibility mode on iPhone X


Does anyone know how to build app targeting iOS 11 on Xcode 9 but still have it run in compatibility mode on iPhone X such that it still shows the top and bottom bar borders rather then scale app to fill the screen?

In case this confuses people on the new iPhone X when an old iOS 10 or lower app is run it will run in "Compatibility Mode" which will show a black bar on top and bottom of screen much the way an iPhone app looks on an iPad.


Solution

  • The simplest way to do this it to set static launch images to your project. It's not ideal but I don't know of another way to force compatibility other than building using the iOS 10 as the base SDK.

    For those who need some steps setting a static launch image

    1. You can add the static image in your Images.xcassets. Click the + button at the bottom of the xcassets column and select App Icons & Launch Images > New iOS Launch Image. Now add all the static launch images for all the devices that you support apart from the iPhone X.

    2. Now set your project up to use the static launch images instead of a xib file. Select your project root in the folder hierarchy and select the General tab. Scroll down until you get to the App Icons and Launch Images section. Now remove the entry for Launch Screen File and select your new LaunchImage from the dropdown for Launch Images Source.

    enter image description here

    (Hmm… just spotted a typo in Xcode 9 Launch Images Sourc …anyway)

    When you build for the iPhone X, it will see that there are no static launch images for the iPhone X and run it in compatibility mode.