1

我正在使用 ios phonegap 应用程序中的 inAppBrowser 集成 facebook 和 twitter。昨天晚上它仍然可以正常工作。但是今天在登录时我在控制台中收到以下错误:

“webView:didFailLoadWithError - 找不到具有指定主机名的服务器。”

我该如何解决这个问题?请提出解决方案...

谢谢

4

1 回答 1

0
You are not showing your code, so not able to see what your authorize url? If thats url not working , you can use following code.

连接 = 功能(client_id,redirect_uri,显示) this.client_id = client_id; this.redirect_uri = redirect_uri;

var authorize_url  = "https://graph.facebook.com/oauth/authorize?";
    authorize_url += "client_id=" + client_id;
    authorize_url += "&redirect_uri=" + redirect_uri;
    authorize_url += "&display="+ ( display ? display : "touch" );
    authorize_url += "&type=user_agent";

var ref = window.open(authorize_url, 'random_string', 'location=no');
ref.addEventListener('loadstart', function(event) {
                     //alert(event.type + ' - ' + event.url);
} );
ref.addEventListener('loadstop', function(event) {
    var access_token = event.url.split("access_token=")[1];
    var error_reason = event.url.split("error_reason=")[1];

     if(access_token != undefined){
           access_token = access_token.split("&")[0];               
         setTimeout(function() {
                    ref.close();
                    }, 5000);

     }
     if(error_reason != undefined){

          window.location.href = "error.html";
          setTimeout(function() {
                    ref.close();
                    }, 5000);
     }
        //console.log(event.url); alert(event.type + ' - ' + event.url);

} );
ref.addEventListener('exit', function(event) {
                     //alert(event.type);
} );}
于 2013-10-19T13:22:33.013 回答