1
Data: <?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://192.168.80.41:8081/WebServiceTest.asmx">[
{
"NonCID": "n10909",
"Name": "aaaa",
"ClassType": "aa",
"City": "aaa",
"Area": "aaa",
"Address": "aaaa",
"TelArea": "02",
"Tel": "29857456",
"Latitude": 25.062047000000000,
"Longitude": 121.495241000000000
},
{
"NonCID": "n10957",
"Name": "xxxx",
"ClassType": "xx",
"City": "xxx",
"Area": "xxx",
"Address": "xxxxx",
"TelArea": "02",
"Tel": "29736693",
"Latitude": 25.061227100000000,
"Longitude": 121.495149900000000
},
{
"NonCID": "n10958",
"Name": "xxxx",
"ClassType": "xx",
"City": "xxx",
"Area": "xxx",
"Address": "xxxx",
"TelArea": "02",
"Tel": "29821024",
"Latitude": 25.061812900000000,
"Longitude": 121.495274000000000
}]</string>
這裏是我的代碼
Alamofire.request("http://localhost/WebServiceTest.asmx/") .responseData { response in
debugPrint("All Response Info: \(response)")
if let data = response.result.value, let utf8Text = String(data: data, encoding: .utf8) {
print("Data: \(utf8Text)")
}
}
當我運行這段代碼獲取數據,如我工作,我無法將數據表單[{「noncid」:「xxxx」,「Name」:「bbb」,........ etc}]轉換爲字典。
有誰知道我該如何獲取數據到字典,我可以使用。 或有另一種方式可以做到這一點。謝謝大家的支持
它的工作!!感謝很多歡呼聲 – Jeff