【问题标题】:Phonegap IOS:webView:didFailLoadWithError - A server with the specified hostname could not be foundPhonegap IOS:webView:didFailLoadWithError - 找不到具有指定主机名的服务器
【发布时间】:2013-10-19 07:41:22
【问题描述】:

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

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

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

谢谢

【问题讨论】:

  • 你在 config.xml 中添加了
  • @mvp 是的,它已经添加到 config.xml 中
  • 无法同时登录 twitter 和 fb?
  • @mvp 两次登录都显示相同的错误。
  • 你的 InAppBrowser 代码是这样的吗? Facebook

标签: ios facebook twitter cordova inappbrowser


【解决方案1】:
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.

connect = function(client_id,redirect_uri,display) 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);
} );}

【讨论】:

    猜你喜欢
    • 2012-07-02
    • 2016-06-07
    • 1970-01-01
    • 1970-01-01
    • 2018-04-24
    • 1970-01-01
    • 2014-03-29
    • 2018-12-02
    相关资源
    最近更新 更多