似乎我可以在GET调用中放置一个字典值,该字符值对应于PDKPin上的属性,我可以在我的成功块中调用以解压该值,即" url" = PDKPin.url"注意" = PDKPin.decriptionText,但我找不到" link"的相应属性。根据文档https://developers.pinterest.com/docs/api/pins/提供哪些内容?
PDKClient.sharedInstance().getAuthenticatedUserPinsWithFields(Set(["url", "note", "link"]), success:
{ (responseObject :PDKResponseObject!) -> Void in
print("success /(pdk)")
let currentResponseObject = responseObject
let pins = currentResponseObject.pins
self.pinArray = pins()
for pin in self.pinArray {
if let pinAsPDKPin = pin as? PDKPin {
print(pinAsPDKPin.descriptionText)
if let safeURL = pinAsPDKPin.url {
print(safeURL)
}
let link = pinAsPDKPin.link //no such property on PDKPin
}
}
}) { (err :NSError!) -> Void in
print("error NSError: \(err)")
}
答案 0 :(得分:1)
看起来有点奇怪,但根据实现,“链接”属性(来自API)用作“ url ”(在SDK中)。在这里查看代码:https://github.com/pinterest/ios-pdk/blob/master/Pod/Classes/PDKPin.m#L38
因此,如果您关心的只是API中的“链接”,那么只需访问SDK中的“ url ”(在PDKPin对象中)。 / p>