取 json 技巧: 通过模拟器
-
注意 nil 错误
-
形式为 plist
extension UIViewController{
func columnContents(get send: R_get_column_contents, completion done: @escaping (Column_detail) -> Void){
print(NSTemporaryDirectory())
Base.netHud.request(.get_column_contents(send)) { (result) in
do{
let data = try result.get().data
// let test = String(data: data, encoding: .utf8)
// print(test ?? "gg")
let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions())
if let dict = json as? NSDictionary, let dictIn = dict["data"] as? NSDictionary {
let haha = dictIn.write(toFile: "/Users/jzd/Movies/Videos/two.plist", atomically: true)