Use UIAlertController when available

This commit is contained in:
Andreas Linde
2015-07-22 15:37:51 +02:00
parent 29acf3ef05
commit cb00038222
9 changed files with 681 additions and 168 deletions

View File

@@ -291,12 +291,33 @@
if(succeeded) {
//controller should dismiss us shortly..
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
message:error.localizedDescription
delegate:nil
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
otherButtonTitles:nil];
[alertView show];
// requires iOS 8
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
if (uialertcontrollerClass) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
message:error.localizedDescription
delegate:nil
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
otherButtonTitles:nil];
[alertView show];
#pragma clang diagnostic pop
}
typeof(self) strongSelf = weakSelf;
[strongSelf setLoginUIEnabled:YES];
}