Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nishabe/9f258ecfc3c3c8b4a9d7 to your computer and use it in GitHub Desktop.
Save nishabe/9f258ecfc3c3c8b4a9d7 to your computer and use it in GitHub Desktop.
OBJC:UIAlertController : 'UIAlertView' is deprecated, use UIAlertController with a preferredStyle
// UIAlertController example. 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated.
// Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
// More at: http://useyourloaf.com/blog/uialertcontroller-changes-in-ios-8/
- (void) handleError{
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:nil
message:@"Incorrect Credentials"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"OK action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"OK action");
}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment