5

I want to post an image on to pinterest account from my iPhone application, there is no any API release from pinterest thats why i am trying to integrate it with URL Scheme but didn't get successed on it. Here is the code for it,

- (void)pinThroughURLScheme {
    NSString *urlString = PinterestURLMake(self.image, nil, @"alt", @"image.jpeg", NO);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}

NSString *PinterestURLMake(UIImage *image, NSString *urlString, NSString *alt, NSString    *title, BOOL isVideo) {
    NSString *base64ImageString = [NSString stringWithFormat:@"data:image/png;base64,%@",    NSStringFromUIImage(image)];
    NSString *encodedBase64ImageString = [base64ImageString urlEncodeUsingEncoding:NSUTF8StringEncoding];
    NSString *encodedURLValue = [urlString urlEncodeUsingEncoding:NSUTF8StringEncoding];
    NSString *encodedAltValue = [alt urlEncodeUsingEncoding:NSUTF8StringEncoding];
    NSString *encodedTitleValue = [[NSString stringWithFormat:@"%@ %.0fx%.0f pixels", title, image.size.width, image.size.height] urlEncodeUsingEncoding:NSUTF8StringEncoding];
    NSString *videoValue = isVideo ? @"true" : @"false";    
    return [NSString stringWithFormat:@"pinterest://pin/create/bookmarklet/?url=URL-OF-THE-PAGE-TO-PIN&media=URL-OF-THE-IMAGE-TO-PIN&description=ENTER-YOUR-DESCRIPTION-FOR-THE-PIN",
        encodedBase64ImageString,
        urlString ? [NSString stringWithFormat:@"&url=%@", encodedURLValue] : @"",
        alt ? [NSString stringWithFormat:@"&alt=%@", encodedAltValue] : @"",
        title ? [NSString stringWithFormat:@"&title=%@", encodedTitleValue] : @"",
        videoValue];
}  

After running this code, didn't get any response from my iPhone device.

Dan Hanly
  • 7,829
  • 13
  • 73
  • 134
Apple
  • 736
  • 1
  • 6
  • 24

2 Answers2

3

Well since you know the basics, maybe you can check out the following link , hope it helps you :)

iOS application integration with pinterest

Community
  • 1
  • 1
IronManGill
  • 7,222
  • 2
  • 31
  • 52
  • Thanks a lot, and sorry because i am not able to vote you , don't have too 15 or more reputations. – Apple Oct 09 '12 at 10:29
  • Its alrite @TapanNathvani you can check the answer to correct... I upvoted ur question :) – IronManGill Oct 09 '12 at 10:32
  • i will check that code, then sure mark your post as a Answer, again thanks a lot,,,,!!! – Apple Oct 09 '12 at 10:43
  • Ur welcome , anything else I can do please let me know :) !!! – IronManGill Oct 09 '12 at 10:48
  • Hello, I want to integrate pinterest to xcode without webView or UIWebView, i just want to post image directly through my application like in Twitter or Facebook. So is it possible ? because still pinterest doesn't release their official API. – Apple Oct 09 '12 at 13:07
  • I have browsed a bit but havent found anything :( ... As soon as I find something useful i'll get back to u .... :) Cheers ... – IronManGill Oct 09 '12 at 13:16
  • I hope pinterest will release their API soon.... – Apple Oct 09 '12 at 13:21
  • 1
    Well they will most probably ... everyone does eventually :) – IronManGill Oct 09 '12 at 14:57
2

As of May 20th 2013, Pinterest have released an iOS SDK for pinning content.

Check out their Developers site for more information.

Amy Worrall
  • 16,250
  • 3
  • 42
  • 65
  • Thanks Amy, i am looking forward to integrate Pinterest to my iOS application with its SDK – Apple May 23 '13 at 06:10