在facebook中分享html

时间:2013-01-10 05:49:26

标签: iphone ios objective-c html5 ipad

在我的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];

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,solutionrender 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}}