我得到響應從服務器這樣在斯威夫特
[{
"images":[{
"title_de":"sdfs",
"title_it":"dsdfs",
"title_fr":"dfsf",
"approved":"true",
"title_ru":"sdsf",
"title_ko":"sdfs",
"title_jp":"sfsdf",
"title_es":"sdfs",
"title_pt":"dfs",
"folder_id":29,
"title_en":"title image",
"title_hi":"sdfss",
"image_used_count":"0",
"updatedtime":"1470641760",
"folder_empty":"false",
"id":115,
"is_folder":"false"
},
{
"title_de":"tests Ashdod",
"title_it":"test cv",
"title_fr":"tests Asgard",
"approved":"true",
"title_ru":"testvxcv",
"title_ko":"testvcxv",
"title_jp":"tests cv",
"title_es":"testvcxv",
"title_pt":"test cox",
"folder_id":19,
"title_en":"testsds",
"title_hi":"testvxcv",
"image_used_count":"0",
"updatedtime":"1470401264",
"folder_empty":"false",
"id":99,
"is_folder":"false"
}]
}]
現在我想顯示在文本視圖這種反應,因爲它是和這裏是我的代碼
self.tv_response.text = String(format:"%@", JSON as! String)
但收到的錯誤
無法投類型的值 '__NSCFArray'(0x1025a8ae0)到 '的NSString'(0x101c13b20)。
我也嘗試
self.tv_response.text = NSString(format:"%@", JSON as! String)
但不工作,請幫我...
從響應你想要什麼TextView中顯示? –
我想顯示總回覆。意味着全數組 –