| Summary: | Disabling portrait orientations in Info.plist crashes application | ||
|---|---|---|---|
| Product: | SDL | Reporter: | cedega.git |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | don't know | ||
| Hardware: | iPhone/iPod touch | ||
| OS: | iOS (All) | ||
| Attachments: | Patch to fix crash when Info.plist orientations don't match the SDL window's orientation. | ||
The supported orientations at runtime is based on the intersection of the orientations in Info.plist with the orientations that the SDL window supports.
If you don't create your SDL window with SDL_WINDOW_RESIZABLE, then the window will base its supported orientations on the width and height you pass in (unless you use SDL_HINT_ORIENTATIONS.)
For example, SDL_CreateWindow("", 0, 0, 480, 320, 0) would create a window that only supports portrait orientations.
If iOS can't find any common supported orientations between the window and Info.plist, then it triggers the exception you encountered.
(In reply to Alex Szpakowski from comment #1) > For example, SDL_CreateWindow("", 0, 0, 480, 320, 0) would create a window > that only supports portrait orientations. And by portrait I mean landscape (for that example)... heh. Created attachment 2146 [details]
Patch to fix crash when Info.plist orientations don't match the SDL window's orientation.
Here's a patch which makes the window choose exclusively from the Info.plist orientations if none of the orientations it would have chosen are listed in Info.plist.
This should prevent the crash issue.
The patch has been applied in the SDL repository: https://hg.libsdl.org/SDL/rev/fceb5503cadf Feel free to reopen the issue if that doesn't fix it for you. |
Removing portrait orientations in Info.plist crashes the App on iOS devices: <Error>: *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES' The crash only happens on physical devices (in this case, iPhone 4 iOS 7.1). In addition, even if portrait + landscape mode is supported in Info.plist, the App refuses to rotate from portrait mode (portrait mode is locked). Forcing correct orientations can be achieved manually by overwriting to: - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } in SDL_uikitviewcontroller.m SDL version is 2.0.4-9574.