Integrating Pinterest with my iOS app [closed]

青春壹個敷衍的年華 提交于 2019-12-21 15:45:16

问题


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.


回答1:


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

Check out their Developers site for more information.




回答2:


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

iOS application integration with pinterest



来源:https://stackoverflow.com/questions/12794598/integrating-pinterest-with-my-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!