iOS Swift: 无法使用 PinterestSDK 创建 Pinterest Pin 图

iOS Swift: Can't create pinterest pin with PinterestSDK

我在尝试使用 Pinterest SDK 创建图钉时遇到问题,我使用此代码:

PDKClient.sharedInstance().createPin(with: imageToShare, link: URL.init(string: "https://someUrl"), onBoard: "MyBoard", description: "", 
    progress: { (percent) in
    }, withSuccess: { (response) in
        print("Success")
    }) { (error) in
        if let error = error {
            print(error)
        }
    }

我收到了这个特别的回复:

Error Domain=com.alamofire.error.serialization.response Code=-1011
"Request failed: not found (404)" UserInfo
{NSLocalizedDescription=Request failed: not found (404),
NSErrorFailingURLKey=https://api.pinterest.com/v1/pins/

用户登录到 Pinterest 应用程序,就在调用这行代码之前,我能够通过相同的 API 成功创建名称为 MyBoard 的图板,但我被困在图钉的创建过程中。 我尝试用图像 url 创建图钉(因为我认为这可能是因为我的图像),但它输出相同的响应。 我在同一代码中使用 twitter 和 facebook sdk,Info.plist 似乎没问题。 有什么线索吗?

显然问题是,onBoard 实际上不需要板名,而是标识符。因此,当您以编程方式创建针板时 - (PDKClient.sharedInstance().createBoard) 您应该获取并保存它的标识符,可以在响应中获取 (response.board().identifier).

在过去的 1.5 小时里,我一直被这个问题困住,在发布问题后就想通了 :) 我认为它对其他人有用,因为官方 SDK wiki 的信息不多,而且 git 存储库也很死。