Rawan
Rawan

Reputation: 1639

Share Pin using Pinterest SDK

I'm trying to post a pin from my app to Pinterest.

I followed there Documentation : iOS Pin It SDK.

It's so simple, but each time I try to pin the image the app raise an exception, or the Pinterest app opened normally but when I pin the image I got this error:

error in client id

It seems like there is a problem in get the right client id.

I searched about this problem and I found this result: message sent to deallocated instance using Pinterest SDK , but it didn't work for me!

My code:

var pin = Pinterest(clientId: "1446186", urlSchemeSuffix: "prod")
var urll = NSURL(string: "http://placekitten.com.s3.amazonaws.com/homepage-  samples/200/287.jpg")!
var sourceURL = NSURL(string: "http://placekitten.com")!
pin.createPinWithImageURL(urll, sourceURL: sourceURL, description: "Pinning from Pin It Demo")

Upvotes: 1

Views: 907

Answers (1)

priyadharshini
priyadharshini

Reputation: 158

try the following code....its i am using in my project...

_pinterest = [[Pinterest alloc] initWithClientId:@"XXXXX" ];
NSString *imageKey =[NSString stringWithFormat:@"%@",Url];
NSString *captionKey = TempCaption;

NSLog(@"pinterest :%@ -- %@",imageKey,captionKey);
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@",imageKey]];
NSURL *sourceUrl = [NSURL URLWithString:kServiceStoreLink];
NSString *descrStr = [NSString stringWithFormat:@"%@",captionKey];
[_pinterest createPinWithImageURL:imageUrl
                        sourceURL:sourceUrl
                      description:descrStr];

Upvotes: 1

Related Questions