如何使用最新的iOS SDK在Pinterest中共享图像

Boo*_*h M 5 objective-c ios pinterest

我想在Pinterest中分享图片.我已经配置了没有CocoaPods的Pinterest iOS SDK.

我编写的代码让我重定向到Pinterest应用程序并获得授权.但在那之后我没有得到任何回应.

在以前版本的iOS SDK中,我们只需要传递该图像的URL.但现在它也在询问Board id.

我不知道如何获得电路板ID并在Pinterest中共享图像,因为我没有从成功块中获得任何响应.

这是我正在使用的代码.

[[PDKClient sharedInstance] authenticateWithPermissions:[NSArray arrayWithObjects:PDKClientReadPublicPermissions, nil] withSuccess:^(PDKResponseObject *responseObject) {  

        NSLog(@"Response Object:%@",responseObject);

    } andFailure:^(NSError *error) {

        NSLog(@"Error:%@",error);
}];
Run Code Online (Sandbox Code Playgroud)

我正在尝试过去一周.请建议我在哪里犯错误.

谢谢.

Adi*_*tya 1

您可以通过以下代码使用 Pinterest api 获取主板信息:

PDKClient.sharedInstance().getAuthenticatedUserBoardsWithFields(NSSet(array: ["id","image","description","name"]) as Set<NSObject>, success: { 
(responseObject: PDKResponseObject!) -> Void in

        self.currentResponseObject = responseObject
        self.boardsArray = responseObject.boards()

        print("self.boards are \(self.boardsArray)") //Contains identifiers(board-id) which is used for image sharing

        })
        {
            (err :NSError!) -> Void in
            print("e rror NSError: \(err)")
            self.hideHUD()
    }
Run Code Online (Sandbox Code Playgroud)