Pinterest SDK如何获取PDKPin的link?
Pinterest SDK how to get a PDKPin's link?
似乎我可以在 GET 调用中放置一个字典值,它对应于 PDKPin 上的 属性,我可以在我的成功块中调用它来解压该值,即 "url" = PDKPin.url "note" = 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)")
}
看起来有点奇怪,但根据实现,使用了'link'属性(来自API)作为“url”(在 SDK 中)。在此处查看代码:https://github.com/pinterest/ios-pdk/blob/master/Pod/Classes/PDKPin.m#L38
因此,如果您只关心 API 中的“link”,那么只需访问“url' in the SDK(in PDKPin object).
似乎我可以在 GET 调用中放置一个字典值,它对应于 PDKPin 上的 属性,我可以在我的成功块中调用它来解压该值,即 "url" = PDKPin.url "note" = 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)")
}
看起来有点奇怪,但根据实现,使用了'link'属性(来自API)作为“url”(在 SDK 中)。在此处查看代码:https://github.com/pinterest/ios-pdk/blob/master/Pod/Classes/PDKPin.m#L38
因此,如果您只关心 API 中的“link”,那么只需访问“url' in the SDK(in PDKPin object).