Ios 将图像从本地包发布到PinInterest iphone。

Ios 将图像从本地包发布到PinInterest iphone。,ios,iphone,objective-c,post,uiimage,Ios,Iphone,Objective C,Post,Uiimage,我使用以下代码通过web视图实现了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 h

我使用以下代码通过web视图实现了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;
NSString*description=@“在此处发布您的描述”;
NSURL*sUrl=[NSString stringWithFormat:@”http://4.bp.blogspot.com/-w4oTZjlpgwo/T5_pi-KJPuI/AAAAAAAAAoM/rKm3E0XCbgY/s1600/red_rose_flower3.jpg"];// 将您的链接和您的图像名称传递到此处
//NSLog(@“URL:%@”,sUrl);
NSString*protectedUrl=(NSString*)CfBrigingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)sUrl,NULL,(CFStringRef)@“!*”\”():@&=+$,/?%#[]”,CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
NSLog(@“受保护的URL:%@”,protectedUrl);
NSString*imageUrl=[NSString stringWithFormat:@“\”%@\”,sUrl];
imageUrl=[[NSBundle mainBundle]路径资源:mAppDelegate.imagename类型: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:@”“;
[htmlString appendFormat:@“

”,按钮URL]; [htmlString appendFormat:@“

”,图像URL]; [htmlString appendFormat:@”“; [htmlString appendFormat:@”“; 返回htmlString;
我也尝试过使用PinInterest iOS SDK,但我发现它只能从url锁定图像


我需要从本地bundle image中锁定图像。任何帮助都将不胜感激。

阅读文档一次,他们现在说,“我们只支持从url锁定图像。将来,我们将添加对固定本地映像的支持。“我想这回答了你的问题。如需更多说明,请参阅reed。希望这有帮助:)

谢谢你的回答,但是我可以将图片上传到我的dropbox和google drive,并提供链接url以供发布吗,苹果会允许吗?是的,但我很害怕,如果我的应用程序会因此被苹果拒绝。。