adam0101
adam0101

Reputation: 1198

Post to Pinterest from an iOS app without leaving the app?

I successfully integrated the Pinterest iOS SDK and can pin items, but it takes the user out of the app. Is there a way to do this but stay within the app?

I followed this guide already (How to integrate Pinterest in ios application)

Upvotes: 2

Views: 2435

Answers (3)

modusCell
modusCell

Reputation: 13429

Yes you can pin items without leaving your app. It is mentioned in other answers, Pinterest has no official API. However their original web site using HTTP POST methods and you can do same thing programatically with using NSURLRequest and NSURLConnection or any other wrappers as like AFNetworking.

It is kinda hacky way but since they have no API this is the only way to do it. Only the downside, if they change something on their site code you should update your code regarding. I have released a OS X application couple months back, it is working fine since then.

I would like to write everything down here however it is almost complete application, this why I have prepared a sample app for you. If you decide to use this you have to tidy up the code little bit. You can download sample project from GitHub

How it works: Basically you have to login to Pinterest with using UIWebView, once you logged in UIWebView write cookies, we are going to use those cookies in HTTP headers to authenticate. (If you want to support social media logins you have to implement those separately)

Once we have the cookie, first thing first getting board list. -(void)getBoardList, then next step is choosing the board which you want to pin (you have to implement this, for now it show up 1st board in the list).

Pinning is two step operation here, At the first step you need to upload image to storage of Pinterest which -(IBAction)uploadImage:(id)sender method handles it. If image upload success it automatically call -(void)pinImage:(NSString *)imageURL to register your image to the selected board.

When you review the code you will see all variables hardcoded, you have to implement all of them as well. As I said this is at least gives you the idea how you can pin image to Pinterest. There is not error control in the code as well. while trying if you don't have any board, probably it will throw and error.

Upvotes: 1

Michael Frederick
Michael Frederick

Reputation: 16714

No, you cannot currently pin an item without leaving your app. The Pinterest API is pretty limited in my opinion. The only pinning functionality that they support for iOS is detailed in the iOS Pin It SDK, which is what you are already using.

Upvotes: 0

Daxesh Nagar
Daxesh Nagar

Reputation: 1415

The SDK provided by Pinterest only has the Pin it functionality, as described on their developer website. You cannot login with that SDK, but you can Pin images with it.you can login but can't get the response.

Pinterest has no official API for logging in, but they do use OAuth2 protocol. So you might have to write your own UIWebView handler that will allow the logging in. This will require research of OAuth2 protocol and storing cookies.

Check this GitHub project.

There is some more information in the following questions:

Log in with Pinterest
pinterest api documentation

may be this help you.

Upvotes: 2

Related Questions