I am trying to show a UIAlertController
every time the user start the app.
- (void)viewDidLoad {
[super viewDidLoad];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"My alert" message:@"This should be come when the app start" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *yesButton = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:yesButton];
[self presentViewController:alert animated:YES completion:nil];
}
But this is not working. I run the app in Xcode simulator. The app runs but no alertview is showing. What am I doing wrong?