GithubHelp home page GithubHelp logo

isabella232 / ios-pdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from parkerdonat/ios-pdk

0.0 0.0 0.0 491 KB

Pinterest iOS SDK

Home Page: https://developers.pinterest.com/docs/sdks/ios/

License: MIT License

Objective-C 99.03% Ruby 0.97%

ios-pdk's Introduction

Caveat -- Deprecation

Pinterest considers this SDK deprecated. You can still build an integration with Pinterest into your iOS app using the RESTful endpoints directly. Best practice guidelines exist about use of OAuth within a mobile application. For instance, see RFC 8252.

For documentation on the API itself, visit the Pinterest Developers website.

PinterestSDK for iOS

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.

Installation

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 => "https://github.com/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

Setting up your App

Registering Your App

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.

Configuring Xcode

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].

Xcode Screenshot

Configuring PDKClient

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.

Authenticating

To authenticate a user, call authenticateWithPermissions:withSuccess:andFailure: on PDKClient. If the current auth token isn't valid or this is the first time you've requested a token, this call will cause an app switch to either the Pinterest app or Safari. To handle the switch back to your app, implement your app's application:openURL:sourceApplication:annotation: as follows:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [[PDKClient sharedInstance] handleCallbackURL:url];
}

For iOS9 and latter application:openURL:sourceApplication:annotation: was deprecated, so you should implement application:openURL:options as follows:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
{
  return [[PDKClient sharedInstance] handleCallbackURL:url];
}

Example App

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.

Documentation

For the full documentation and more information about the Pinterest Developer Platform, please visit:

PinterestSDK for iOS

Pinterest API Docs

Pinterest API signup

ios-pdk's People

Contributors

rcancro avatar levi avatar jparise avatar garrettmoon avatar antrix1989 avatar timonus avatar connor avatar tgblank avatar arunranga avatar darrenlevy avatar martinw avatar rahul-malik avatar fikeminkel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.