在我的iPad应用程序中,我正在加载HTML5页面,我想将这些页面分享到Facebook。可能吗?我搜索了很多,但找不到任何帮助。我的应用应支持iOS5或更高版本。任何帮助都要感激。
我在下面用来分享图片。
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
[variables setObject:graph_file forKey:@"file"];
[variables setObject:@" image : Shared Via IOS application" forKey:@"message"];
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];
答案 0 :(得分:0)
我遇到了同样的问题,solution
是render HTML5 pages
中的UIWebView
以及capture image
加载share
然后+(UIImage *)imageFromWebView:(UIWebView *)view
{
// tempframe to reset view size after image was created
CGRect tmpFrame = view.frame;
// set new Frame
CGRect aFrame = view.frame;
aFrame.size.height = [view sizeThatFits:[[UIScreen mainScreen] bounds].size].height;
view.frame = aFrame;
// do image magic
UIGraphicsBeginImageContext([view sizeThatFits:[[UIScreen mainScreen] bounds].size]);
CGContextRef resizedContext = UIGraphicsGetCurrentContext();
[view.layer renderInContext:resizedContext];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// reset Frame of view to origin
view.frame = tmpFrame;
return image;
}
。
{{1}}