share video on Pinterest

2019-08-08 10:10发布

问题:

I am developing an application that want to share video on Pinterest. I search on SO i found for image

https://pinterest-ota-builds.s3.amazonaws.com/PinItDemo.zip

http://developers.pinterest.com/ios/

and I download the framework, in frame work only one file is available

Pinterest.h

@interface Pinterest : NSObject

- (id)initWithClientId:(NSString *)clientId;

- (id)initWithClientId:(NSString *)clientId
   urlSchemeSuffix:(NSString *)suffix;

- (BOOL)canPinWithSDK;

- (void)createPinWithImageURL:(NSURL *)imageURL
                sourceURL:(NSURL *)sourceURL
              description:(NSString *)descriptionText;

+ (UIButton *)pinItButton;

@end

There is no any type of method for login and authentication, No any type of method for video sharing.

I also find this iOS Pin It SDK with no documentation and sample code

I also used this using UIWebView and its working fine in ImageUrl not for video or without url.

 - (NSString*) generatePinterestHTML {
     NSString *description = @"Post your description here";

     NSString *sUrl = [NSString stringWithFormat:@"http://www.alkalima.com/images/08-02/nature.jpg"];
     NSLog(@"URL:%@", sUrl);
     NSString *protectedUrl = ( NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,( CFStringRef)sUrl, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
     NSLog(@"Protected URL:%@", protectedUrl);
     NSString *imageUrl = [NSString stringWithFormat:@"\"%@\"", sUrl];
     NSString *buttonUrl = [NSString stringWithFormat:@"\"http://pinterest.com/pin/create/button/?url=www.flor.com&media=%@&description=%@\"", protectedUrl, description];

     NSMutableString *htmlString = [[NSMutableString alloc] initWithCapacity:1000];
     [htmlString appendFormat:@"<html> <body>"];
     [htmlString appendFormat:@"<p align=\"center\"><a href=%@ class=\"pin-it-button\" count-layout=\"horizontal\"><img border=\"0\" src=\"http://assets.pinterest.com/images/PinExt.png\" title=\"Pin It\" /></a></p>", buttonUrl];
     [htmlString appendFormat:@"<p align=\"center\"><img width=\"400px\" height = \"400px\" src=%@></img></p>", imageUrl];
     [htmlString appendFormat:@"<script type=\"text/javascript\" src=\"//assets.pinterest.com/js/pinit.js\"></script>"];
     [htmlString appendFormat:@"</body> </html>"];
     return htmlString;
 }

 - (void) postToPinterest {
     NSString *htmlString = [self generatePinterestHTML];
     NSLog(@"Generated HTML String:%@", htmlString);
     webViewPinterest.backgroundColor = [UIColor clearColor];
     webViewPinterest.opaque = NO;
     if ([webViewPinterest isHidden]) {
         [webViewPinterest setHidden:NO];
     }
     [webViewPinterest loadHTMLString:htmlString baseURL:nil];
 }

please help me for sharing video on Pinterest

回答1:

It seems that now you can share only the pictures, but not video with they SDK.

From http://developers.pinterest.com/ios/:

Right now, we only support pinning an image from a url. In the future, we’ll add support for pinning local images.