2013-01-10 72 views
0

在我的iPad應用程序中,我正在加載HTML5頁面,我想將這些頁面分享到Facebook。可能嗎?我搜查了很多,但找不到任何幫助。我的應用應該支持iOS5或更高版本。任何幫助不勝感激。在Facebook上分享html

我在下面用來分享圖像。

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

請澄清一下您的問題。 Facebook允許共享HTML鏈接或媒體。 「HTML5網頁」的格式是什麼? – Raptor

回答

0

我有同樣的問題,solutionrender HTML5 pagesUIWebView當它加載從它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; 
}