obj c uiwebview facebook评论让app变慢

时间:2012-04-25 15:24:31

标签: ios facebook uiwebview comments

我在iOS的uiwebview中使用facebook评论社交插件。它工作正常,但在打开几分钟后它会降低整个应用程序帧率。有人经历过吗?有人有解决方案吗?

我尝试创建新项目,然后只添加一个带有Facebook评论的uiwebview。打开它几分钟后,应用程序也会变慢。

这是facebook评论 https://developers.facebook.com/docs/reference/plugins/comments/

这是我的代码

        commentWebView = [[UIWebView alloc] initWithFrame:(CGRect){15, 50, 500, 376}];
        commentWebView.delegate = self;
        commentWebView.backgroundColor = [UIColor clearColor];
        commentWebView.opaque = NO;
        [commentLikeView addSubview:commentWebView];
        NSString* html = [NSString stringWithFormat:@"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html><head> <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\"> <title>Facebook Comments Test Page</title> <style type=\"text/css\"> .fb-comments, span, .fb-comments iframe[style] {width: %dpx !important;}</style> </head> <body > <div id=\"fb-root\"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";  fjs.parentNode.insertBefore(js, fjs); }(document, \"script\", \"facebook-jssdk\"));</script> <fb:comments href=\"%@\" num_posts=\"10\" width=\"470\"></fb:comments> </body> </html>", (int)commentWebView.frame.size.width, link];
//<div class=\"fb-comments\"  data-href=\"%@\" data-num-posts=\"10\" ></div> 
        [commentWebView loadHTMLString:html baseURL:[NSURL URLWithString:@"http://www.facebook.com"]];

0 个答案:

没有答案