我可以很容易地在iPhone上用facebook登录。但我听说,pinterest没有官方的API。
所以我想知道是否有一种方法可以用Pinterest实现登录。因此,我的应用程序可以在用户登录pinterest后识别他。
发布于 2012-12-05 13:54:47
Without an official Pinterest public API,你写的任何其他的变通方法都很容易被破坏。最好是直接向Pintrist注册,希望他们会给你提供测试版SDK或API的访问权限,一旦他们想出来了。
这就是说,there appears to be some stuff potentially available,但不确定当前的状态是什么。
发布于 2012-12-05 14:05:54
Pintrest使用oAuth2您应该能够使用它类似于所有其他提供商,即GET请求到某个url以获得令牌,逐步说明可以在这里http://tijn.bo.lt/pinterest-api找到
OAuth2是一个官方api问题归结为寻找端点和获取语法需要注意的一件事是返回的对象可以包含不同的值来访问提供者例如我需要Twitter和FB的解决方案,但是Twitter没有给你用户的电子邮件,所以你必须单独请求它(在提供者之间唯一标识相同的帐户)对于ruby有一个omniauth gem可以让你轻松地使用多个提供者(策略)。推出自己的解决方案或为IOS找到一个库应该不会太复杂
发布于 2012-12-05 14:06:03
嗨,Pinterest没有官方的api,但是
Here是已应答的链接
或者像这样尝试,用下面的目标创建按钮
[pintrestBtn addTarget:self action:@selector(pintrestButtonSelcted) forControlEvents:UIControlEventTouchUpInside]
当htmlstring作为完美的url出现时,推送将其推送到另一个具有webview的视图控制器,并在该webview中加载此htmlstring
- (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;}
https://stackoverflow.com/questions/13717133
复制相似问题