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

Forge Viewer 3.2.x版本Document.load在移动设备抛异常问题咨询

Alright, let's tackle this Forge Viewer 3.2.x issue you're facing—super tricky when the docs say a parameter is required but desktop browsers let you get away with skipping it, right? Let's break down what's happening and fix that mobile error.

Issue Breakdown

First, let's recap the key details:

  • You're using Autodesk.Viewing.Document.load(documentId, onSuccessCallback, onErrorCallback, accessControlProperties) where the official docs mark accessControlProperties as required.
  • Skipping this parameter works fine on Chrome/Firefox desktop, but throws a TypeError: Cannot read property 'id' of null in mobile browsers, specifically in the PinchRecognizer logic.
  • You can't switch to Viewer.loadDocument() because you need to load multiple models.

The error stack points directly to the viewer's gesture handler initialization on mobile—unlike desktop, mobile doesn't have a fallback for missing accessControlProperties, so the pinch recognition logic tries to read an id property from a null value.

Fixes to Try

Even without official examples for this parameter, we can construct a minimal valid object to satisfy the SDK's internal checks:

1. Quick Fix: Pass an Empty Object

Start with the simplest approach—pass an empty object as the accessControlProperties parameter. Most SDKs handle empty configurations gracefully:

Autodesk.Viewing.Document.load(
  documentId,
  onSuccessCallback,
  onErrorCallback,
  {} // Empty access control config
);

2. More Robust Fix: Pass a Basic Config Object

If the empty object doesn't work, explicitly include the id field (since the error is about reading 'id' of null) using your model's documentId:

const accessControlProps = {
  id: documentId, // Reuse your existing document ID here
  permissions: [] // Empty permissions array (adjust if you need specific access rules)
};

Autodesk.Viewing.Document.load(
  documentId,
  onSuccessCallback,
  onErrorCallback,
  accessControlProps
);

Why This Works

The mobile gesture recognition module in Forge Viewer 3.2.x expects accessControlProperties to exist to initialize properly—desktop browsers have a hidden fallback that mobile doesn't. By passing even a minimal valid object, you prevent the SDK from trying to access properties on a null value, which resolves the pinch recognizer error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 08:27:17