I can easy implement log in with facebook on iPhone. But I heared, that there was no official API for pinterest.
So I wonder if there is a way to implement login wi
Hi there is no official api for Pinterest, But
Here is a link already answered
or try like this, create button with the following target
[pintrestBtn addTarget:self action:@selector(pintrestButtonSelcted) forControlEvents:UIControlEventTouchUpInside]
and push when the htmlstring
comes as perfect url push it to another viewcontroller which has webview and load this htmlstring
in that webview
- (void) pintrestButtonSelcted {
NSString *htmlString = [self generatePinterestHTMLForSKU:nil];
NSLog(@"Generated HTML String:%@", htmlString);
WebViewController *webViewController = [[WebViewController alloc] init];
webViewController.htmlString = htmlString;
webViewController.view.frame = CGRectMake(0, 0, 300, 300);
[self presentModalViewController:webViewController animated:YES];
}
- (NSString*) generatePinterestHTMLForSKU:(NSString*)sku {
NSString *description = @"Post your description here";
// Generate urls for button and image
NSString *sUrl = [NSString stringWithFormat:@"http://reedperry.com/2011/04/27/apple-logo/"];
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=http://itunes.apple.com/us/app/pinterest/id429047995?mt=8&media=http://reedperry.com/2011/04/27/apple-logo/%@&description=Welcome you all%@\"", 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;
}
Pintrest uses oAuth2 you should be able to use it akin of all the other providers ie GET request to a certain url to obtain the token, step by step instructions can be found here http://tijn.bo.lt/pinterest-api
OAuth2 is an official api the issue boils down to finding the endpoint and GET syntax One thing to note is the object that is being returned can contain different values accross providers for instance I needed a Twitter and FB solution, but Twitter doesn't give you user's email so you had to ask for it separately (to uniquely identify the same account accross providers) For ruby there's the omniauth gem that lets you use multiple providers (strategies) with ease. Shouldn't be to complicated to roll out your own solution for or find a library for IOS
Without an official Pinterest public API, anything else you write to be some kind of workaround is likely to break very easily. Best to register with Pintrist directly and hopefully they'll seed you with access to a beta SDK or API, once they come up with it.
That said, there appears to be some stuff potentially available but not sure what the current status is.