Pinterest SDK integrates in iOS apps

Samsul Hoque
5


step : 1 Register for a Client ID from here
step : 2 Install the SDK 
The SDK is a cocoapod, so you’ll need a podfile for your app before you begin. To install the SDK:
  1. Open your Podfile and add the following dependency in the target “<your-app>” do section:
    pod “PinterestSDK”, :git => “git@github.com:pinterest/ios-pdk.git”
    
  2. OR
  3. pod "PinterestSDK", :git => "https://github.com/pinterest/ios-pdk.git"
  4. Save your Podfile.
  5. Run pod install from the command line. You've now installed the iOS SDK.


step : 3 Configure Xcode
You’ll need to configure .plist on your project in order to redirect back to your app after authentication. Do this by adding a URL scheme to your .plist.
In Xcode, right-click your .plist and select Open As > Source Code. Copy and paste the following code inside the <dict>...</dict>, replacing {your-app-id} with your App ID.
<key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLName</key>
      <string></string>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>pdk{your-app-id}</string>
      </array>
    </dict>
  </array>

step : 4 Configure the PDK Client

Finally, you’ll need to link your App ID to the PDK Client in your app.

[PDKClient configureSharedInstanceWithAppId:@"12345"];

step : 5 To use the Pinterest framework you will need to import it into your file.
 #import "PDKPin.h"

step : 6 To use the standard PinIt Button in a view add it as so:

UIButton *pinItButton = [UIButton buttonWithType:UIButtonTypeSystem];
pinItButton.translatesAutoresizingMaskIntoConstraints = NO;
[pinItButton setTitle:NSLocalizedString(@"PinIt", nil) forState:UIControlStateNormal];
[pinItButton addTarget:self action:@selector(pinItButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:pinItButton];
step : 7 You will need to handle the action an example of this is below:

- (void)pinItButtonTapped:(UIButton *)button
  {

  [PDKPin pinWithImageURL:[NSURL URLWithString:@"http://placekitten.com/500/400"]
                   link:[NSURL URLWithString:@"https://www.pinterest.com"]
     suggestedBoardName:@"ABC-XYZ"
                   note:@"The Pinterest Logo"
            withSuccess:^
 {
     NSLog(@"successfully pinned pin");

 }
             andFailure:^(NSError *error)
 {
            NSLog(@"pin it failed");

 }];
}

Note : If plist file was missing the BundleDisplayName. In order to solve this problem you just need to add it to the plist file.

<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>



Post a Comment

5Comments
  1. I am a professional blogger, and I value Pinterest a lot. The reason I can say this proudly is because I use PinPinterest com as my Pinterest account automation. PinPinterest is so amazing that I can schedule my posts according to my desired time and I don’t need to be online all day for that too. A mobile-friendly awesome tool for Pinterest.

    ReplyDelete
  2. Very well written about pinterest sdk. If you want videos of pinterest app, please download vidmate. To use any app, it is very important to know something about that app, so if you want to install any new video and audio downloader app, then you should install better Vidmate app than that. It is very good. With the help of this app, you can easily download all your favorite audio videos with one search and one click. This app works absolutely free, this app doesn't cost you even ₹1 just with the help of your good internet connection this app starts working very well. You can also download pinterest app and Vidmate from 9apps

    ReplyDelete
Post a Comment