0
CoreDataを取り込むためにJSONを受け取るには投稿を行う必要があります。今まで私はGETだけだった。Swift RestKitは本体にJSONを投稿しません
チャールズからの呼び出しを見ても、どのような組み合わせであっても、本文には何もありません。
let storedProcedureParams =
[
"params": [
[
"name": "p_latitude",
"param_type": "IN",
"value": latitude
],
[
"name": "p_longitude",
"param_type": "IN",
"value": longitude
],
[
"name": "p_distance",
"param_type": "IN",
"value": distance
],
[
"name": "p_user",
"param_type": "IN",
"value" : user
],
[
"name": "p_appKey",
"param_type": "IN",
"value" : appDelegate.api_key
]
],
"schema": [
"id": "integer",
"complete": "boolean"
],
"wrapper": "record"
]
let mapping = RKObjectMapping.requestMapping()
mapping.addAttributeMappingsFromDictionary(storedProcedureParams)
let requestDescriptor = RKRequestDescriptor(mapping:mapping,objectClass:Store.self, rootKeyPath:nil, method:RKRequestMethod.POST)
objectManager.addRequestDescriptor(requestDescriptor)
objectManager.addResponseDescriptor(responseDescriptor)
objectManager.requestSerializationMIMEType = RKMIMETypeJSON
objectManager.postObject(storedProcedureParams, path: "_proc/StoresByDistance", parameters: nil,
success:{ operation, mappingResult in
NSLog("success")
},
failure:{ operation, error in
NSLog("Error loading list': \(error!.localizedDescription)")
//return nil
}
);
明らかなことはありますか?