GarySabo
GarySabo

Reputation: 6700

Pinterest SDK how to get a PDKPin's link?

It seems that there is a dictionary value I can place in the GET call that corresponds to a property on PDKPin that I can call in my success block to unpack the value, i.e. "url" = PDKPin.url "note" = PDKPin.decriptionText, however I can't find a corresponding property for "link" which is available per the documentation 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)")
    }

Upvotes: 0

Views: 437

Answers (1)

James
James

Reputation: 2764

It looks kinda weird, but as per the implementation, the 'link' property(from the API) is used as 'url'(in the SDK). Check out the code here : https://github.com/pinterest/ios-pdk/blob/master/Pod/Classes/PDKPin.m#L38

So, if all that you care about is the 'link' from the API, then just access 'url' in the SDK(in PDKPin object).

Upvotes: 1

Related Questions