我已经成功编写了一个简单的 fiddle,它会导致 native iOS facebook 应用程序崩溃。
如果您将此链接粘贴到您的时间线中 http://jsfiddle.net/Gc58e/ (它只是一个简单的按钮,带有带有照片范围的 FB.login 回调)并从 native iOS 应用程序中打开它,它在 Web View 中打开。
html
<div id="fb-root"></div>
<div class="box">
<div class="info">Let's see if we can crash it!</div>
<button class="login">Login with Facebook</button>
</div>
javascript
window.fbAsyncInit = function () {
FB.init({
appId: '467875209900414'
});
};
(function (d) {
var js, id = 'facebook-jssdk';
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
$('.login').on('click', function () {
FB.login(function (response) {
alert('login callback' + JSON.stringify(response));
}, {
scope: 'user_photos'
});
});
当您单击该按钮时,会显示身份验证窗口,在单击取消 或确定 后,整个应用程序崩溃。
如果您直接使用 Safari 或在任何其他浏览器中查看它,则不会发生这种情况。
我已经看到许多流行的应用程序在从 native iOS Facebook 应用程序内的嵌入式 webview 进行身份验证时也会崩溃;所以这可能是一个错误,或者只是正确的方法不明显......
最佳答案
它现在已经被 Facebook 修复了。我已经对其进行了测试,似乎工作正常。
关于javascript - 从网络应用程序调用 FB.login() 时,官方 Facebook iOS 应用程序总是崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16236928/