iosuialertviewios8uialertviewdelegateuialertcontroller

Dismiss UIAlertView on Xcode 5 and iOS 8


My app is ready to go to the App Store, so I'm still using Xcode 5 at the moment. However, when I installed it on my iPad with iOS 8 there was a strange problem.

I create an Alert just fine with delegate:self. But the function to dismiss the alert is just not working (it's in another method and working fine on all other devices).

I tried:

[alertLaden dismissWithClickedButtonIndex:[alertLaden cancelButtonIndex] animated:YES];

and NO

[alertLaden dismissWithClickedButtonIndex:0 animated:YES]; 

and NO

[alertLaden dismissWithClickedButtonIndex:-1 animated:YES]; 

and NO

Anybody with the same problem?


Solution

  • In iOS 8 Apple is trying to switch to UIAlertController instead of UIAlertView and UIActionSheet.

    From UIAlertController documentation:

    A UIAlertController object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts.

    However, Apple does not state in UIAlertView and UIActionSheet that they are deprecated. Using UIActionSheet I got warnings in Xcode 6, which were resolved when switching to UIAlertController.