iOS 8.3 supported orientations crashs

前端 未结 4 1539
花落未央
花落未央 2020-12-16 04:56

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 \'UIApplica

相关标签:
4条回答
  • 2020-12-16 05:33

    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;
    }
    
    0 讨论(0)
  • 2020-12-16 05:45

    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

    0 讨论(0)
  • 2020-12-16 05:46

    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

    0 讨论(0)
  • 2020-12-16 05:58

    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

    0 讨论(0)
提交回复
热议问题