相关疑难解决方法(0)

'UIAlertView'在iOS 9.0中已弃用.使用UIAlertController而不是UIAlertControllerStyleAlert的preferredStyle

我看到了更多的答案,但没有任何帮助.这是我的旧警报和行动

override func viewWillAppear(animated: Bool) {
    if Reachability.isConnectedToNetwork() == true {
        print("internet connection ok")
    } else 
    {
        print("internet not ok")
        let alertView: UIAlertView = UIAlertView(title: "Alert ", message: "connect to internet", delegate: self, cancelButtonTitle: "settings", otherButtonTitles: "cancel")
        alertView.show()
        return       
    }       
}

func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int)
{
    if buttonIndex == 0 {
        //This will open ios devices wifi settings
        UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root")!)
    }
    else if buttonIndex == 1
    {
        //TODO for cancel
        exit(0) 
    }
}
Run Code Online (Sandbox Code Playgroud)

在那我得到警告:

'UIAlertView'在iOS 9.0中已弃用.使用UIAlertController而不是UIAlertControllerStyleAlert的preferredStyle

我试过了 : …

uialertview ios swift uialertcontroller

33
推荐指数
3
解决办法
5万
查看次数

标签 统计

ios ×1

swift ×1

uialertcontroller ×1

uialertview ×1