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

喜夏-厌秋 提交于 2019-12-10 10:23:23

问题


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:


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

funziona correttamente



来源:https://stackoverflow.com/questions/27668986/pinterest-ios-2-3-and-swift-calling-createpinwithimageurl-results-in-exc-bad-ac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!