我看到了更多的答案,但没有任何帮助.这是我的旧警报和行动
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
我试过了 : …