“AppMobi.device” [未定义] 不是对象......在设备上测试时出现错误
我想检查正在运行的应用程序的“设备型号”。
为此,我使用了以下函数
function CheckCurrentDeviceModel() {
var Device = AppMobi.device.model;
try {
Device = Device.toLowerCase();
}
catch (Error) {
alert(Error);
}
return Device;
}
这就是我的调用方式:
var device = CheckCurrentDeviceModel();
在 appMobi“模拟器”上,它工作正常,但在检查设备
TypeError 时出现以下错误:表达式结果 “AppMobi.device”[未定义] 不是对象
任何帮助将不胜感激。
谢谢
I want to check the "device model" on which app is running.
For this i used following funciton
function CheckCurrentDeviceModel() {
var Device = AppMobi.device.model;
try {
Device = Device.toLowerCase();
}
catch (Error) {
alert(Error);
}
return Device;
}
This is how i called :
var device = CheckCurrentDeviceModel();
On appMobi "Emulator" its working fine but getting following error when checking on device
TypeError: Result of expression
"AppMobi.device" [Undefined] is not an object
Any help would be highly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 AppMobi 论坛上回答了这个问题,但您的问题很可能是您在触发 appMobi.device.ready 事件之前调用此函数。如果您查看代码,应该有一个该事件的侦听器。将您的呼叫移至该位置。
I answered this over on the AppMobi forums, but your issue is most likely you care calling this before the appMobi.device.ready event is fired. If you look in your code, there should be a listener for that event. Move your call up to that.