You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS 17.6 Safari下AR.js定位式A-Frame移动AR功能异常求助

AR.js基于定位的AR应用在iOS Safari 17.6中无法显示3D元素问题

我正在开展AR与无障碍方向的本科毕业论文,开发一款需在iOS和Android浏览器运行的移动AR导航应用,采用AR.js的基于定位方案,计划在相机画面特定位置放置标识点优化导航。

当前遇到的问题:示例代码在Android原生浏览器运行正常,但在iOS 17.6的Safari中无法正常工作——页面通过HTTPS加载,GPS、设备方向及相机权限弹窗均正常弹出并授权,但相机视图里始终看不到放置的3D元素。

代码示例(嵌入Angular框架,核心逻辑沿用AR.js官网示例)

<html>
  <head>
    <title>AR.js A-Frame Location-based</title>

    <!-- old A-Frame (from example of ar.js)-->
    <script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>

    <!-- new A-Frame (directly from aframe.io). It isn't even starting the camera -->
    <!--  <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script> -->

    <!-- these should be the most up-to-date versions (since it's the master branch) -->
    <script type='text/javascript' src='https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar-threex-location-only.js'></script>
    <script type='text/javascript' src='https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js'></script>
  </head>


  <body>
    <a-scene vr-mode-ui='enabled: false' arjs='sourceType: webcam; videoTexture: true; debugUIEnabled: false' renderer='antialias: true; alpha: true'>
      <a-camera gps-new-camera='gpsMinDistance: 5'></a-camera>

      <!-- Box which is to be displayed. Obviously the coordinates are not my real ones -->
      <a-entity material='color: red' geometry='primitive: box' gps-new-entity-place="latitude: 10; longitude: 20" 
      scale="10 10 10"></a-entity>

      <!-- Solution from another stackoverflow post. Didn't fix it for me (Coordinates aren't real) -->
      <a-box material="color: blue" gps-entity-place="latitude: 10; longitude: 20" position="0 350 0" scale="3.5 3.5 3.5" rotation="0 180 0"> </a-box>

    
    </a-scene>
  </body>
</html>

注:当前使用AR.js示例推荐的A-Frame 1.3.0版本,换成1.6.0版本时相机无法启动。

页面加载时还出现错误:无法加载dpdb.webvr.rocks资源(无服务器连接),不确定是否与当前问题相关。

已尝试的解决方案(均无效)

  • 切换AR.js、A-Frame的不同版本
  • 在多台iOS设备上测试
  • 尝试iOS端Chrome、Firefox浏览器
  • 测试AR.js基于标记的AR功能(可正常工作)
  • 查阅资料(仅看到有人提及iOS11+可运行,但未说明具体方法)
  • 参考Stack Overflow相关问题

目前怀疑iOS设备未向框架正确提供GPS位置,但不确定具体原因,希望有经验的开发者提供解决方案或指出可能的疏漏。

内容的提问来源于stack exchange,提问作者Sven Luipold

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 09:57:41