Why iOS 8.3 Crashes When UIAlertView Pops: Orientation Mismatch Debugging
The QQ mobile team discovered that iOS 8.3 caused crashes when switching image quality or showing UIAlertView because the view controller returned an incorrect orientation type, and they resolved it by correcting the supportedInterfaceOrientations implementation and avoiding system‑internal classes.
On April 9, iOS 8.3 was released and the QQ mobile team immediately verified compatibility. They found a reproducible crash when switching between low‑resolution and original images in the image picker, with many user reports on forums and support channels.
The crash was traced using the Bugly platform, which provided stack information pointing to UIView addSubview and the exception: <code>Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [_QQMarkActionSheetController_FixPos shouldAutorotate] is returning YES'</code>
Further testing confirmed that the crash scenario matched the recorded stack trace. The root cause was a mismatch between the orientation of QQMarkActionSheetController_FixPos and the application.
Initial fix involved locating the source of QQMarkActionSheetController_FixPos (a subclass of UIAlertController) and overriding its shouldAutorotate method to return NO. After recompiling, the crash disappeared.
Additional hidden crash scenarios were discovered:
Canceling after editing an image. Sending a short video after turning off Wi‑Fi.
Both scenarios also involved a UIAlertView prompt and produced a similar orientation‑related exception.
Because _UIAlertShimPresentingViewController is a system internal class, its shouldAutorotate method could not be overridden, prompting a deeper investigation.
The team replaced all UIAlertView usages with a custom SimpleAlertView, which resolved the crashes in those paths, but the sheer number of UIAlertView calls (over 500 in 300+ files) made a wholesale replacement impractical.
Attention then shifted to the image picker controller. The controller’s supportedInterfaceOrientations method returned UIInterfaceOrientationPortrait (a single orientation value) instead of the required UIInterfaceOrientationMaskPortrait (an orientation mask). This mismatch caused the system to raise the exception when a UIAlertView was presented.
Fix: change the return value of supportedInterfaceOrientations to UIInterfaceOrientationMaskPortrait and remove the overridden shouldAutorotate in QQMarkActionSheetController_FixPos . After recompiling and testing, the crashes no longer occurred.
In summary, the crash was caused by returning the wrong type from supportedInterfaceOrientations (using UIInterfaceOrientation instead of UIInterfaceOrientationMask) in iOS 8.3, which triggered a system check and resulted in an exception whenever an alert view was presented.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Tencent TDS Service
TDS Service offers client and web front‑end developers and operators an intelligent low‑code platform, cross‑platform development framework, universal release platform, runtime container engine, monitoring and analysis platform, and a security‑privacy compliance suite.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
