Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to load Facebook-Comments plugin in a UIWebView
    primarykey
    data
    text
    <p>I'm trying to view a facebook-comments plugin in a UIWebView on an iPhone application. </p> <p>I began with Facebook's <a href="http://developers.facebook.com/docs/mobile/ios/build/">iOS tutorial</a>, where I implemented Single Sign-On. The app delegate takes care of Facebook's Single Sign-on, then redirects me to my single view controller, which displays a title bar and a UIWebView.</p> <p>I load the webview with a local file called "comments.html" which has been added and copied to my bundle/project directory.</p> <pre><code>NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"comments" ofType:@"html"] isDirectory:NO]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; </code></pre> <p>My html file is the bare-bones version of the plugin implementation, as generated at the <a href="http://developers.facebook.com/docs/reference/plugins/comments/">Facebook Comments Plugin</a> description site. I plugged in a url and clicked "Get Code." I took the HTML5 code that they provided me, and stuck it in an html file as so</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;script&gt;(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_GB/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));&lt;/script&gt; &lt;div class="fb-comments" data-href="http://www.bombslo.com" data-num-posts="4" data-width="470"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The UIWebView loads just fine on my simulator. I hosted and launched the html on my device and it loads fine in Safari. The problem is that <strong>the UIWebView will not load the Facebook-comments plugin in an embedded UIWebView.</strong> </p> <p>An important thing to note is that I am not getting a blank screen. I see two animated loading bars, typical to Facebook. Also note that the Facebook-generated code comes in both HTML5 and XFBML. I've tried using both.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload