gpt4 book ai didi

ios - 如何解决此错误 "Cannot invoke getObejectAtPath with argument list type of string"

转载 作者:行者123 更新时间:2023-11-30 14:07:20 24 4
gpt4 key购买 nike

我正在配置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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com