iOS 8.3 supported orientations crashs
Asked Answered
A

4

7

I have a big problem with my app and iOS 8.3. I have many crashes with always the same error:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [... shouldAutorotate] is returning YES

When "..." are many classes. A particular problem is the class UIAlertView, I have the same problem of UIAlertView crashs in iOS 8.3 but I can't resolve subclassing UIAlertView (Apple says that the UIAlertView class is intended to be used as-is and does not support subclassing) or using UIAlertController. Can you help me?

Antimacassar answered 14/4, 2015 at 13:47 Comment(5)
"Supported orientations has no common orientation with the application" appeared for me when f.e application doesn't support landscape but UIViewController returns YES for landscapeCabdriver
We cannot help you without code to see how you are subclassing UIAlertView.Include
Apple says that the UIAlertView class is intended to be used as-is and does not support subclassing, I can't subclass UIAlertView so I can't show you nothingAntimacassar
change to UIAlertController, UIAlertView is deprecatedBirthroot
I change but the error is always the same: Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES'Antimacassar
C
6

A lot of other apps didn't crash with this bug, so I was wondering if there was something else in our app that accounted to this crash. I made sure iOS 8 would get the UIAlertController so it wouldn't crash but that doesn't help with third-party frameworks.

Another engineer in our team eventually fixed it by doing this:

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
    // This used to be:
    //return UIInterfaceOrientationPortrait;
}
Carving answered 28/4, 2015 at 15:37 Comment(1)
Thank goodness for this answer! I had exactly the same issue.Abampere
E
2

I don't know what changed from iOS 8.2 to 8.3 and why they changed it, because it was working fine. It's annoying.

Anyway I solved this problem with the gist on link.

https://gist.github.com/mkeremkeskin/0ed9fc4a2c0e4942e451

Endospore answered 16/4, 2015 at 21:17 Comment(0)
C
1

After trying the solutions here, none of them worked for me. I'm supporting iOS 6-8 in an app, and, more than that, use some libraries that use UIAlertView internally, so simply conditionally compiling to use UIAlertController when available was not an option.

I came up with a solution that solved the problem for me. Your mileage may vary. I include the header file in the Header Prefix file so that it's sure to be included anywhere a UIAlertView is shown.

I'm posting this here for anyone who's stumbling on this problem and the solutions found around the net don't work. Hopefully it's helpful.

https://gist.github.com/joshhudnall/cdc89b61d0a545c85d1d

Certification answered 28/4, 2015 at 23:21 Comment(0)
P
0

I solved this problem with this:

if objc_getClass("UIAlertController") != nil {

     println("UIAlertController can be instantiated")

     //make and use a UIAlertController iOS8

}
else {

     println("UIAlertController can NOT be instantiated")

     //make and use a UIAlertView iOS7
}

Then you can keep your app run in iOS 7 and iOS 8

Patron answered 25/4, 2015 at 2:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.