I'm developing an app that needs to run on iOS 7 as well as 8. I want to use the UIAlertController if possible, if not fall back to UIAlertView.
I use this test:
let gotUIAlertController:AnyClass? = NSClassFromString("UIAlertController")
if( gotUIAlertController != nil )
{
// Do UIAlertController
}
else
{
// DO UIAlertView
}
This appears to work on iOS8 simulator, in debug mode but when in release mode (or running debug mode with instruments), gotUIAlertController is not nil, so the UIAlertController is trying to present and the app crashes. The deployment target is 7.1 with the bas SDK set to 8.1
Can anyone enlighten me on why this code is executing in such a way on iOS7.1?
I don't know why, but the workaround I found is: