我正在配置restkit,但遇到类似错误
"cannot invoke getObjectAtPath" with argument list.....
那么如何解决这个问题,我也想全局编写函数。
func fatchingData() {
var queryParams = ""
var path = "property_type/"
RKObjectManager.sharedManager().getObjectsAtPath(path, parameters: queryParams, success: { operation, mappingResult in
self.resultData = mappingResult.array()
},
failure:{ operation, error in
println("error")
}
)
}
最佳答案
queryParams
有问题。您将其声明为 String
,但它必须是 Dictionary
。
这里是它的示例代码:
func loadVenues() {
let latLon = "37.33,-122.03" // approximate latLon of The Mothership (a.k.a Apple headquarters)
let queryParams = [
"ll": latLon,
"client_id": kCLIENTID,
"client_secret": kCLIENTSECRET,
"categoryId": "4bf58dd8d48988d1e0931735",
"v" : "20140617"
]
RKObjectManager.sharedManager().getObjectsAtPath("/v2/venues/search", parameters: queryParams,
success:{ operation, mappingResult in
self.venues = mappingResult.array()
self.tableView.reloadData()
},
failure:{ operation, error in
NSLog("What do you mean by 'there is no coffee?': \(error!.localizedDescription)")
}
)
}
引用HERE .
希望有帮助。
关于ios - 如何解决此错误 "Cannot invoke getObejectAtPath with argument list type of string",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32201274/