Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Using the Pinterest-IOS SDK (2.3) I'm getting a EXC_BAD_ACCESS error when creating an instance of the SDK via the Swift Bridge and then calling createPinWithImageURL. When converting the same code back to objective-c and then calling a wrapper method from Swift it works as expected. The root cause seems to be passing the appID and suffix strings from Swift to Objective-C.

This code fails:

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 appId on the objective-c side:

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

I've created a project that demonstrates this:

Sample Project

like image 705
shooley Avatar asked Dec 11 '25 18:12

shooley


1 Answers

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

funziona correttamente

like image 96
Raffaele Avatar answered Dec 13 '25 14:12

Raffaele



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!