| Summary: | Patch to support iOS 8 launch screen NIBs | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Eric wing <ewmailing> |
| Component: | main | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.3 | ||
| Hardware: | iPhone/iPod touch | ||
| OS: | iOS (All) | ||
This is pulled, thanks! https://hg.libsdl.org/SDL/rev/0895ce420b99 Do we need to add any documentation for this behavior? |
I have a pull request for support for iOS 8's new LaunchScreen NIBs. Apple changed their way of handling it yet again. Their motivation was that it is getting unwieldy to provide so many different launch screen permutations for every device and orientation. Their "Autolayout" system can handle this in a simplified/unified way, so for iOS 8, this is the new way to do it. Furthermore, this is the only way to get the "Optimized for iPhone 6 and iPhone 6 Plus" badge on the App Store as far as I can tell. So this patch is necessary. This normally should be automatically handled by the operating system, but because SDL reverse-engineers and reinvents the CocoaTouch launch and run loop, SDL doesn't inherit this new behavior. This patch uses the old launch screen handling code as a starting point. It mirrors the original technique, i.e. creates a new class to handle it. To not break legacy behavior, a runtime check is done for iOS 8 or greater. Additionally, this patch conforms to Apple rules of behavior. This only kicks in if the user has made an entry in their Info.plist. They must specify the key UILaunchStoryboardName and supply the name of the NIB/XIB file (without the extension). Example: <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> Presumably, the NIB/XIB is already correctly made with AutoLayout for their launch screen. Omitting the Info.plist setting will then revert to legacy behavior. The code will result in Cocoa throwing an exception if the Info.plist specifies the key, but the corresponding nib does not exist. Additional note: I noticed the legacy iOS 7 behavior does not conform to the rules Apple has in their documentation. iOS 7 is supposed to allow you to manually specify launch screens for different resolutions, devices, and orientations, but SDL lacks this code. I consider this a bug and was scratching my head for a really long time. While it would be good to fix, the rate of latest iOS adoption may render the need for that obsolete within 3 months. Furthermore, AutoLayout does technically work on iOS 7. It might be possible to activate this new iOS 8 behavior for iOS 7. However, some people might be surprised if we do this. Testing notes: I tested on all the different permutations of devices on the iOS Simulator for both iOS 8 and 7, to verify that both the Launch Screen was working on iOS 8, and the legacy path was taken on 7. I did not test on a real device though. (Key signing problems at the moment.) https://bitbucket.org/ewing/sdl_ios8launchscreen