ios - 将本地包中的图像发布到 Pinterest iphone。

标签 ios iphone objective-c post uiimage

我使用以下代码通过 Web View 实现了 PinInterest:

NSString *description = @"Post your description here";
NSURL* sUrl = [NSString stringWithFormat:@"http://4.bp.blogspot.com/-w4oTZjlpgwo/T5_pi-KJPuI/AAAAAAAAAoM/rKm3E0XCbgY/s1600/red_rose_flower3.jpg"];// pass your link here with your image name

// NSLog(@"URL:%@", sUrl);
NSString *protectedUrl = ( NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,( CFStringRef)sUrl, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)));
NSLog(@"Protected URL:%@", protectedUrl);
NSString *imageUrl = [NSString stringWithFormat:@"\"%@\"", sUrl];

imageUrl=[[NSBundle mainBundle]pathForResource:mAppDelegate.imagename ofType:nil];

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=\"300px\" 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;

我也尝试过使用 PinInterest iOS SDK,但我发现它只能固定来自 url 的图像。

我需要从本地捆绑图像中固定图像。任何帮助将不胜感激。

最佳答案

阅读文档一次,他们说,现在,“我们只支持固定来自网址的图像。将来,我们将添加对固定本地镜像的支持。”我认为这回答了你的问题。需要更多说明芦苇this .希望这有帮助:)

关于ios - 将本地包中的图像发布到 Pinterest iphone。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18643165/

相关文章:

ios - 统一 5 和 IL2CPP : cannot build

ios - ios中如何制作圆形动画

ios - 使用 `moveRowAtIndexPath:toIndexPath:` 和 `estimatedRowHeight` 时 `UITableViewAutomaticDimension` 中的 UITableViewCell 动画错误

iphone - 将 iPhone 应用程序转换为通用应用程序?

iphone - MapKit 自定义注释

iphone - ASIHTTP请求问题

objective-c - UIView animateWithDuration : animations: completion: applies transform, 没有动画

ios - 如何在没有任何导航 Controller 的情况下从 vc1.view 过渡到 iOS 中的 vc2.view?

ios - 我可以在低电量时唤醒 iOS 应用程序吗?如何?

iphone - 使用后退按钮时 UISwitch 会切换到 OFF 状态