设备重力传感 在ios 13 有问题 提示 permission granted

  • Creator 版本:2.3.3

  • 目标平台:
    Web

  • 详细报错信息,包含调用堆栈:

  • 重现方式:

  • 之前哪个版本是正常的 :

  • 手机型号 :iphone xs max ios 13.3.1

  • 手机浏览器 :safari

  • 编辑器操作系统 :Mac os 10.15.4

不知道是不是我用的不对还是啥
代码截图


官网上的代码

构建:

运行在Safari中

地址:https://daboluo.natapp4.cc/cocosTest (自己弄的内网映射)

可以先获取下权限。
if (typeof DeviceMotionEvent.requestPermission === ‘function’) {
// iOS 13+

DeviceOrientationEvent.requestPermission()
.then(response => {
if (response == ‘granted’) {
window.addEventListener(‘deviceorientation’, (e) => {
// do something with e
})
}
})
.catch(console.error)
} else {
// non iOS 13+
}

DeviceOrientationEvent.requestPermission()…
这端代码 好像 需要 手动处理 写在if else 里面无效
https://blog.csdn.net/qq_26642611/article/details/105614265

楼主解决了吗?怎么解决的,我也碰到在ios上无效在andriod正常。