Messenger Extensions Javascript SDK Error 2071011

▼魔方 西西 提交于 2019-12-03 00:08:26

How are you trying to open the webview? I was facing the same issue but then messenger extensions only work on iOS and Android as per the documentation. This code works for me on iOS and throws the same error on desktop messenger app. I hope this helps.

I found "2071011" error explanation in messenger.Extensions.js minified source:

if (!p) {
    x(2071011, 'JavaScript bridge does not exist - Please make sure you are in latest ' + 'version of Facebook or Messenger App.');
    return;
}

p value equals q():

function q() {
    switch (o) {
        case h.ANDROID:
            return window._FBExtensions;
        case h.IOS:
            return window.webkit && window.webkit.messageHandlers;
    }
    return null;

}

Possible error causes:

  1. Please ensure you have the newest Messenger App version (do not resolve problem in my case).
  2. It is highly possible that Messenger Android app do not include variable window._FBExtensions into WebView context properly - I have this variable undefined and messenger.Extensions.js assumes that _FBExtensions variable already exists. I can't found currently workaround for this as it is Messenger App part.
MessengerExtensions.getUserID(function success(uids) {
            // triggering on devices
            self.defer.resolve(uids.psid);
        }, function error(err) {
            MessengerExtensions.getContext(config.fbApp.id, function success(result) {
                // triggering on desktop
                self.defer.resolve(result.psid);
            }, function error(result) {
                self.defer.reject(result);
                console.log('Context Error ', result);
            });
        });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!