NetworkStatus0 = TypeError:“未定义"不是函数 [英] NetworkStatus0 = TypeError: 'undefined' is not a function

查看:194
本文介绍了NetworkStatus0 = TypeError:“未定义"不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac Lion和Xcode 4.3.1上使用cordova-1.6.1.我遇到以下错误

I'm using cordova-1.6.1 on Mac Lion with Xcode 4.3.1. I'm getting following error

CordovaApp [322:13403] [INFO]成功回调中出错:NetworkStatus0 = TypeError:'undefined'不是函数

CordovaApp[322:13403] [INFO] Error in success callback: NetworkStatus0 = TypeError: 'undefined' is not a function

执行下一行时.

navigator.network.isReachable("phonegap.com",reachableCallback,{});

navigator.network.isReachable("phonegap.com", reachableCallback, {});

函数定义如下

function reachableCallback(reachability) {
  var networkState = reachability.code;
  alert('Connection type: ' + networkState + ' - ' + reachability.message);
}

我很长一段时间都无法弄清这一点.请帮助

I'm unable to figure this out for a quite some time. Please help

亚当

推荐答案

已从PhoneGap中弃用了isReachable方法.您最好查看在线和离线事件等新的网络功能.以及:

The isReachable method has been deprecated out of PhoneGap. You are better off looking at the new Network features like the online and offline events. As well looking at:

navigator.network.connection.type 

将告诉您当前具有哪种类型的网络连接;如果没有连接,则为无.

Will tell you what type of network connection you currently have or None if there is no connection.

这篇关于NetworkStatus0 = TypeError:“未定义"不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆