do{
let strHtml = try NSString(contentsOfURL: NSURL(string: "http://www.google.com")!, encoding: NSUTF8StringEncoding)
print(strHtml)
}catch{
print("error")
}
SWIFT错误处理如何写 上面这么写为什么显示error
do{
let strHtml = try NSString(contentsOfURL: NSURL(string: "http://www.google.com")!, encoding: NSUTF8StringEncoding)
print(strHtml)
}catch{
print("error")
}
SWIFT错误处理如何写 上面这么写为什么显示error
我只能说,因为你确实无法连接 google.com。