Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate Pinterest in ios application

I want to integrate pinterest in my application. i want to add button of pinterest in my app through which i can upload image on pinterest I refer their Developers site but it doesnt help me.

I include SDK and tried their code but it doesnt work for me.

  #import <Pinterest/Pinterest.h>

UIButton* pinItButton = [Pinterest pinItButton];
    [pinItButton addTarget:self
                    action:@selector(pinIt:)
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:pinItButton];

 - (void)pinIt:(id)sender
    {
        [_pinterest createPinWithImageURL:@"http://placekitten.com/500/400"
                                sourceURL:@"http://placekitten.com"
                              description:@"Pinning from Pin It Demo"];
    }

please any help will be appreciated.

Thanks in advance.

like image 316
nishant Thakkar Avatar asked Jun 09 '13 16:06

nishant Thakkar


People also ask

Is Pinterest available on iOS?

Pinterest, Inc. Requires iOS 13.0 or later. Requires iPadOS 13.0 or later.

What iOS do you need for Pinterest?

The Pinterest widget shows ideas from your favorite boards , boards of people you follow, or interests you select so you can get inspired right from your phone's home screen. Note: Pinterest widget is currently only available on iOS 14 or newer. Note: Pinterest widget is currently only available on iOS 14 or newer.

Does Apple use Pinterest?

Now, Apple has entered into a partnership with Pinterest, in which their apps will be downloadable directly through the Pinterest on iPhones and iPads.


1 Answers

I dont understand whats your actual problem but here i provide some easy step to integrate pinterest to your app

step : 1 Register for a Client ID from here

step : 2 Download the SDK from here and drag and drop into your project.

step : 3 You will then need to add a URL type to support opening your app from the Pinterest app , so add URL type to your plist file

Example if your client id is 18571937652947:
pin18571937652947 is the URL Scheme you need to support.

step : 4 To use the Pinterest framework you will need to import it into your file.

 #import <Pinterest/Pinterest.h>

and declare its object in your .h file

 Pinterest *pinterest

step : 5 initialise Pinterest object

 pinterest = [[Pinterest alloc]initWithClientId:@"your app client id"]

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

 UIButton* pinItButton = [Pinterest pinItButton];
    [pinItButton addTarget:self
                    action:@selector(pinIt:)
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:pinItButton];

step : 7 You will need to handle the action an example of this is below:

- (void)pinIt:(id)sender
{
    NSURL *imageURL     = [NSURL URLWithString:@"http://placekitten.com/500/400"];
    NSURL *sourceURL    = [NSURL URLWithString:@"http://placekitten.com"];


    [pinterest createPinWithImageURL:imageURL
                           sourceURL:sourceURL
                         description:@"Pinning from Pin It Demo"];
}

Note : pinterest app should be installed in your device otherwise this code redirect to itunes to download pinterest app

like image 148
pratik bhiyani Avatar answered Oct 19 '22 06:10

pratik bhiyani