我目前需要将用户输入的PUT数据输入到在线服务器阵列中(参见“memberDetails”):
{
"firstName": "Stringy",
"id": 322344,
"memberDetails": [{
"city": "asdf",
"country": "asdf",
"county": "asdf",
}],
]
我可以更新数组外的所有内容,但我不知道如何更新数组中的项目。这是我更新api的函数(注意:我使用单独的函数来更新其他数据,这是严格意义上的“memberDetailsArray”中的内容):
func putMemberDetails (accessToken: String, id: Int, city: String, address: String, state: String) {
//currently test parameters
let parameters: [String: AnyObject] = [
"id" : id,
"city" : city,
"addressLineOne" : address,
"stateOrProvince" : state,
]
Alamofire.request(.PUT, "\(baseApiUrl)members/updatechildren", parameters: parameters, encoding: .JSON, headers: getHeaders())
.responseJSON { response in
print("\(response)")
if((response.result.value) != nil) {
let swiftyJsonVar = JSON(response.result.value!)
print("This is the updateChildren response:\(swiftyJsonVar)")
}
}
}
使用此功能时,我获得了成功的响应,但数据未更改。