似乎可以在GET调用中放入一个字典值,该值对应于PDKPin上的属性,可以在我的成功块中调用该字典值以解压缩该值,即“ url” = PDKPin.url“ note” = PDKPin.decriptionText ,但是找不到文档https://developers.pinterest.com/docs/api/pins/中可用的“ link”对应属性?

    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中的“链接”,则只需访问SDK(在PDKPin对象中)中的“ URL”即可。

关于ios - Pinterest SDK如何获取PDKPin的链接?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34474573/

10-12 03:20