How to integrate Pinterest in ios application

后端 未结 1 1994
小鲜肉
小鲜肉 2021-01-30 14:58

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 Develop

相关标签:
1条回答
  • 2021-01-30 16:00

    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

    0 讨论(0)
提交回复
热议问题