2016-07-26 88 views
-3

當與迅速,編譯器IOS 9 I用戶alertview示出了該警告消息:使用在IOS 9 alertview與迅速

UIAlertView中」在IOS 9.0被棄用:UIAlertView中已被棄用。使用UIAlertController與UIAlertControllerStyleAlert的preferredStyle代替

+1

是的,像有消息稱,它已過時。檢查這個喜歡的文檔:可能解決你的問題http://stackoverflow.com/documentation/ios/874/uialertcontroller#t=201607261258026665057 – Idan

+2

你的問題是什麼? – fantaghirocco

+3

[UIAlertView首次棄用IOS 9]的可能重複(http://stackoverflow.com/questions/32690086/uialertview-first-deprecated-ios-9) –

回答

0

嘗試使用此代碼

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) 
      })