Pinterest-iOS 2.3 and Swift: calling createPinWith

2019-05-14 03:51发布

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

1条回答
Luminary・发光体
2楼-- · 2019-05-14 04:24
        var pinterest:Pinterest = Pinterest()
        pinterest.setValue("your_app_id", forKey: "clientId")
        if(pinterest.canPinWithSDK()){
            pinterest.createPinWithImageURL(imageUrl, sourceURL:sourceUrl, description:pinDescription)
        }

funziona correttamente

查看更多
登录 后发表回答