When I user alertview in ios 9 with swift, compiler shows this warning message:
UIAlertView' was deprecated in iOS 9.0: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
When I user alertview in ios 9 with swift, compiler shows this warning message:
UIAlertView' was deprecated in iOS 9.0: UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
try using this code
let alert = UIAlertController(title: "TITLE", message: "MESSAGE", preferredStyle: UIAlertControllerStyle.Alert)
let okAction = UIAlertAction(title:"OK", style: UIAlertActionStyle.Cancel, handler: { (action) -> Void in
})
alert.addAction(okAction)
dispatch_async(dispatch_get_main_queue(),{
self.presentViewController(alert, animated: true, completion: nil)
})