0

I edited the info.plist and added the UILaunchImages Key. However, I can't get the app to display the launch image that I want. I am doing this to try and create a landscape launch image for iphones. Here's the code.

   <key>UILaunchImages</key>
<array>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default</string>
    <key>UILaunchImageOrientation</key>
    <string>Portrait</string>
    <key>UILaunchImageSize</key>
    <string>{320, 480}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    <key>UILaunchImageSize</key>
    <string>{320, 480}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-568h</string>
    <key>UILaunchImageOrientation</key>
    <string>Portrait</string>
    <key>UILaunchImageSize</key>
    <string>{320, 568}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-568h</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    <key>UILaunchImageSize</key>
    <string>{320, 568}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-667h</string>
    <key>UILaunchImageOrientation</key>
    <string>Portrait</string>
    <key>UILaunchImageSize</key>
    <string>{375, 667}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-667h</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    <key>UILaunchImageSize</key>
    <string>{375, 667}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-736h</string>
    <key>UILaunchImageOrientation</key>
    <string>Portrait</string>
    <key>UILaunchImageSize</key>
    <string>{414, 736}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-736h</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    <key>UILaunchImageSize</key>
    <string>{414, 736}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-Portrait</string>
    <key>UILaunchImageOrientation</key>
    <string>Portrait</string>
    <key>UILaunchImageSize</key>
    <string>{768, 1024}</string>
</dict>
<dict>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>8.0</string>
    <key>UILaunchImageName</key>
    <string>Default-Landscape</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    <key>UILaunchImageSize</key>
    <string>{768, 1024}</string>
</dict>
</array>

I want to replace default with an image of my own, but when I do that it just shows a black screen. Am I missing a step? Is this an iOS 8 problem?

master45
  • 50
  • 1
  • 9

1 Answers1

2

Apple technical note TN2244 (https://developer.apple.com/library/ios/technotes/tn2244/_index.html) provides some basic information on how to add UILaunchImages for iPhone apps that launch only into landscape mode, especially if you want to support iOS8 and iOS7. (Specifically, it gives the XML code shown above, which, once pasted into the Info.plist file, can then be edited in XCode's Project Settings - Info tab). The associated images should be dragged into Xcode's Project Explorer.

That Technical Note also says that in order to support both iOS8 and prior versions, the Asset Catalog must not be used.

So it is a good starting point, but for me it needed further fleshing out. For my app, which I want to be able to run starting from iPhone4s/iOS7 up to iPhone6Plus/iOS8.x in landscape-only, I ran into various problems. The biggest was that although I had created the various launch images (in landscape mode, then rotated them to portrait), added them to my project, and placed the names into the UILaunchImages dictionary exactly as in the Technical Note, the launch image would show correctly for iPhone4s/iOS7, but on iPhone5* and iPhone6, inspite of what was in the LaunchImages, would pick up the iPhone4 image, which it would further rotate before displaying it.

Worse, iPhone5 and iPhone6 would then run only in letterboxed mode, and report screen sizes of 320x480 points. Running on anything under iOS8, I would get the default screen from the LaunchScreen.xib file. I did not want that, either, because I cannot use autolayout at the moment.

The solution I found was posted by Alex Argo, see the question (How do I create launch images for iPhone 6 / 6 Plus Landscape Only Apps?). This involves adding further keys to the Info.plist, also for portrait images even though they are not used. Note below the additional entries for Portrait, which are not included in the Technical Note.

<key>UILaunchImages</key>
<array>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>7.0</string>
        <key>UILaunchImageName</key>
        <string>Img320x568ptsPort@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>7.0</string>
        <key>UILaunchImageName</key>
        <string>Img320x568ptsLdsc@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>7.0</string>
        <key>UILaunchImageName</key>
        <string>Img320x480ptsPort@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{320, 480}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>7.0</string>
        <key>UILaunchImageName</key>
        <string>Img320x480ptsLdsc@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{320, 480}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Img375x667ptsPort@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Img375x667ptsLdsc@2x</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Img414x736ptsLdsc@3x</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Img414x736ptsPort@3x</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
</array>

Interestingly, for iPhone 6Plus, I found that there is no need to rotate a landscape launch image to portrait, as was necessary for all the other landscape launch images.

It also involved blanking out, in the Project Settings, the "Lauch Screen File". Otherwise the default LaunchScreen.xib would sometimes get picked up as the launch screen cases (which is no good to me because the interplay between graphics and text in my app kinda precludes autolayout at this point).

All of this works for me under Xcode 6.4.

Community
  • 1
  • 1
W S
  • 115
  • 12