繁体   English   中英

将 FB.ui 用于“apprequest”和“feed” - JS 错误 - c 未定义

[英]Using FB.ui for “apprequest” and “feed” - JS error - c is not defined

我已经开发了两个带有FB.ui()调用的应用程序来发送应用程序请求并要求使用“feed”参数发布状态更新。 它工作了几个月,但在过去的一周里我遇到了错误:

c 未定义第 18 行:FB.provide('Dom',{containsCss:function...(oldonload);}else oldonload();};})(); 文件:all.js

It's from the file all.js I import to use FB object from the url: http://connect.facebook.net/fr_FR/all.js (i also tried http://connect.facebook.net/en_US/all. js )

这是导致错误的代码部分:

window.addEvent('domready', function() {

    if(jsonRedirection.redirect == false) {

        FB.init({
          appId  : FBappId,
          status : true, // check login status
          cookie : true, // enable cookies to allow the server to access the session
          xfbml  : true  // parse XFBML
        });

    } 

});

function addFriends()
{
    FB.ui({
        method: 'apprequests',
        message: 'Test'
        },
        function(response) {
            if(response != null) {
                alert('ok');
            }
        }
    );
}

在我打电话给我的 addFriends function 之前,我检查了我的 appId 并且我有“fb-root”div ...

“c is undefined” - 这是由于 mootools 冲突而发生的。 在未压缩的 mootools 文件中,有一个 function " Function.implement({ "。您可以通过隐藏它来解决问题。

让我知道,如果你得到这个工作。

准确地说。 使用 In,Function.implement({ 将有一个“create: function(options){”。只需将 'create' 重命名为 'Create'。即,制作 C - 大写字母。我希望这能解决问题。

问题出在 Function 原型中。

Function.implement({
extend: function(properties){
    for (var property in properties) this[property] = properties[property];
    return this;
},

create: function(options){ 

和FB SDK function:

create:function(c,h){var e=window.FB,d=c?c.split('.'):[],a=d.length;for(var b=0;b<a;b++){var g=d[b];var f=e[g];if(!f){f=(h&&b+1==a)?h:{};e[g]=f;}e=f;}return e;}

解决方案:在mootools中,将“create”重命名为“create2”,然后将所有“create(”替换为“create2(”

它的可怕..但是,工作..

MooTools 1.4.3 版解决了这个问题 - 您可以从下载 MooTools 1.4.3下载它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM