Swift 2 jSON Call can throw but it is not marked with try
发布时间:2020-12-14 01:46:24 所属栏目:百科 来源:网络整理
导读:yesterday i updated to El Capitan beta 2 and Xcode 7 - beta is mandatory. So i updated my app to Swift 2 and new error comes to the json string. This is my code : let jsonData:NSDictionary = NSJSONSerialization.JSONObjectWithData(urlData!,
yesterday i updated to El Capitan beta 2 and Xcode 7 - beta is mandatory. So i updated my app to Swift 2 and new error comes to the json string. This is my code :
do { let jsonData = try NSJSONSerialization.JSONObjectWithData(urlData!,options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary // use jsonData } catch { // report error }第二种用法: let (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |