Pinterest-iOS 2.3 and Swift: call createPinWithImageURL results in EXC_BAD_ACCESS

Using Pinterest-IOS SDK (2.3) I get EXC_BAD_ACCESS error when instantiating SDK via Swift Bridge and then call createPinWithImageURL. When converting the same code back to objective-c and then calling the wrapper method from Swift works as expected. The root cause is passing appID and suffix strings from Swift to Objective-C.

This code doesn't work:

self.pinterest = Pinterest(clientId:"your_app_id", urlSchemeSuffix:"prod")!
if(pinterest.canPinWithSDK()) {
    pinterest.createPinWithImageURL(NSURL(string: imageUrl)!, sourceURL:NSURL(string: sourceUrl)!, description:pinDescription)
}

      

This succeeds when setting the appId on the objective-c side:

    self.bainterest = PinterestWrapper.sharedInstance()
    baPinterest.pinRecipe(imageUrl, sourceURL:sourceUrl, description:pinDescription)

      

I created a project that demonstrates this:

Project example

+3


source to share


1 answer


        var pinterest:Pinterest = Pinterest()
        pinterest.setValue("your_app_id", forKey: "clientId")
        if(pinterest.canPinWithSDK()){
            pinterest.createPinWithImageURL(imageUrl, sourceURL:sourceUrl, description:pinDescription)
        }

      



funziona correttamente

+4


source







All Articles