This must be trivial, but I am perplexed! I have an app, which was working perfectly until I Included UIAlertController to launch alerts in lieu of UIAlertView, when the iOS version >=8, as in the following code. I have made no other changes. Now, only when UIAlertController is executed, the ViewController which contains this code is no longer dismissed, creating a second instance when I launch the same ViewController again. It seems as though the UIAlertController windows are not being dismissed properly and are still being referenced, though they are no longer visible. Can someone please tell me what I have not understood? Thanks!
if (versionFloat < 8.0)
{
_finishedAlert = [[UIAlertView alloc] initWithTitle:@“My Project”
message:@"Finished"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[_finishedAlert show];
}
else
{
alertPresentation = [UIAlertController alertControllerWithTitle:@"My Project"
message:@"Finished"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *actionOk = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[self handleFinishedAlert];
}];
[alertPresentation addAction:actionOk];
[self presentViewController:alertPresentation animated:YES completion:nil];
}