The PinterestSDK for iOS will allow you to authenticate an account with Pinterest and make requests on behalf of the authenticated user. For details on the supported endpoint, visit the Pinterest API.
The PinterestSDK is a cocoapod. In order to use it you will need to create a Podfile
if you do not already have one. Information on installing cocoapods and creating a Podfile can be found at Cocoapods.org. (Hint — to install cocoapods, run sudo gem install cocoapods
from the command line; to create a Podfile, run pod init
).
Open up the Podfile and add the following dependency:
pod "PinterestSDK", :git => "[email protected]:pinterest/ios-pdk.git"
Save your Podfile and run 'pod install' from the command line.
You can also just give the example app a try:
pod try https://github.com/pinterest/ios-pdk.git
Visit the Pinterest Developer Site and register your application. This will generate an appId for you which you will need in the next steps. Make sure to add your redirect URIs. For iOS your redirect URI will be pdk[your-appId]
. For example, if you appId is 1234 your redirect URI will be pdk1234
.
The PinterestSDK will authenticate using OAuth either via the Pinterest app or, if the Pinterest app isn't installed, Safari. In order to redirect back to your app after authentication you will need set up a custom URL scheme. To do this, go to your app's plist and add a URL scheme named pdk[your-appId]
.
Before you make any calls using the PDKClient in your app, you will need to configure it with your appId:
[PDKClient configureSharedInstanceWithAppId:@"12345"];
The end of application:didFinishLaunchingWithOptions:
seems like a reasonable place.
A good place to start exploring the PDK is with the example app. To run it browse to the Example directory and run pod install
. Next open PinterestSDK.xcworkspace
in XCode and run it.
For the full documentation and more information about the Pinterest Developer Platform, please visit: