如何整合Pinterest在iOS应用程序

我想在我的应用程序中集成pinterest 。 我想在我的应用程序中添加pinterestbutton,通过它我可以上传图像pinterest我推荐他们的开发者网站,但它不帮助我。

我包括SDK和尝试他们的代码,但它不适合我。

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

请任何帮助,将不胜感激。

提前致谢。

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

步骤:1从这里注册一个客户端ID

步骤:2从这里下载SDK并拖放到您的项目中。

第3步:然后,您需要添加一个URLtypes来支持从Pinterest应用程序中打开您的应用程序,所以添加URLtypes到您的plist文件

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

步骤:4要使用Pinterest框架,您需要将其导入到您的文件中。

  #import <Pinterest/Pinterest.h> 

并在你的.h文件中声明它的对象

  Pinterest *pinterest 

步骤:5初始化Pinterest对象

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

步骤:6要在视图中使用标准PinItbutton,请按如下方式添加:

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

步骤:7你将需要处理这个动作的例子如下:

 - (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应用程序应安装在您的设备,否则此代码redirect到iTunes下载pinterest应用程序