且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ios应用程序中集成Pinterest

更新时间:2021-08-21 02:05:59

我不明白你的实际问题是什么,但在这里我提供了一些简单的步骤将pinterest集成到您的应用程序

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

步骤:1 此处

步骤:2 此处并拖放到您的项目中。

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

步骤:3 然后,您需要添加网址类型以支持从Pinterest应用中打开您的应用,因此将网址类型添加到您的plist文件

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.

步骤:4 要使用Pinterest框架,您需要导入它进入你的文件。

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

 #import <Pinterest/Pinterest.h>

并在.h文件中声明其对象

and declare its object in your .h file

 Pinterest *pinterest

步骤:5 初始化Pinterest对象

step : 5 initialise Pinterest object

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

步骤:6 要在视图中使用标准PinIt按钮,请将其添加为:

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 您需要处理此操作的示例如下:

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"];
}

注意:pinterest app应该安装在你的设备,否则此代码重定向到iTunes下载pinterest app

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