“AppMobi.device” [未定义] 不是对象......在设备上测试时出现错误

发布于 2024-12-27 02:15:39 字数 465 浏览 2 评论 0原文

我想检查正在运行的应用程序的“设备型号”。

为此,我使用了以下函数

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自在安然 2025-01-03 02:15:39

我在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文