我刚刚了解到NSURLSession。我想发布POST请求。它需要JSON作为主体。在swift中使用字典的不同数据类型?
当使用Objective-C我使用NSDictionary,但在迅速I Dictionary只保存1数据类型。在swift中实现这个的另一种方法是什么?
{
"userID" : "xxxxxxxx",
"full_name" : "xxxxxxxxx",
"pob" : "xxxxxxxxxx"
"dob" : "xxxxxxxxxxx",
"status" : 3,
"phone_number" : null,
"education" : [
{
"university" : "xxxxxx",
"location": {
latitude: "xxxxxxx",
longitude: "xxxxxxxx"
},
"degree": "xxxxxx"
},
{
"university" : "xxxxxx",
"location": {
latitude: "xxxxxxx",
longitude: "xxxxxxxx"
},
"degree": "xxxxxx"
}
]
}
我真的卡住了,我已经找了好几个小时,但没有运气的解决方案。在google中没有找到关于此的任何教程。
非常感谢你,对不起我的英文不好。
我不能使用任何的键,它显示了一个错误“类型‘的任何’不符合协议‘哈希的’” – taylorSWIFT 2014-10-06 14:20:44
无需使用任何作为关键。它总是一个字符串。 – 2014-10-06 15:29:54
按@HotLicks建议。或者你可以使用'Dictionary' –
Teejay
2014-10-06 15:32:22