ARKit 在 iOS 11.3 中崩溃

ARKit crashing in iOS 11.3

自 iOS11.3 以来,我从我的 AR 测量应用程序中收到了大量新的崩溃报告。

崩溃描述说: 异常类型:SIGABRT 异常代码:#0 在 0x181b112ec 崩溃线程:0 应用程序特定信息:*** 由于未捕获的异常 'std::invalid_argument' 而终止应用程序,原因:'extrinsicTransform must have determinant 1.'

崩溃是由我代码中的这一行触发的,它是在 didUpdateFrame 上调用的

NSArray<ARHitTestResult *> *resultArray = [_arsnView hitTest:position types:ARHitTestResultTypeExistingPlaneUsingExtent | ARHitTestResultTypeEstimatedHorizontalPlane];

根据崩溃报告,它发生在大约 10% 的会话中 (!!!!)。在 iOS11.3 之前,我的崩溃率低于 0.1%。

我尝试为 hitTest 提供不同的位置值,包括 NaN 等,但我无法重现崩溃。

有什么想法吗?

谢谢!!

更新 1

我在调用hitTest时检查了currentFrame是否仍然有效。尽管用 if(_arsnView.session.currentFrame) 检查了这一点,应用程序仍然显示相同的崩溃:(

感谢您的帮助。我发现在执行 hitTest 之前检查 trackingState 可以解决崩溃问题。所以基本上,我正在检查:

if (_arsnView.session.currentFrame.camera.trackingState!=ARTrackingStateNormal) 
{
     // do not perform hitTest
}
else 
{
     // perform hitTest
}

在此示例中,_arsnView 是 属性 来自 class ARSCNView

有人为此记录 11.3 的错误吗?在 iPhone X

上尝试使用 11.3 测试应用程序会产生相同的效果

我为之前的道歉,昨晚我太缺乏睡眠了。

无论如何,我为 Apple 提出了 TSI,他们返回了以下内容。

Thank you for contacting Apple Developer Technical Support (DTS).

This a known issue when you perform a hit test and the ARCamera’s tracking state is either .notAvailable or .limited.
<https://developer.apple.com/documentation/arkit/arcamera.trackingstate>

The workaround is simply to not hit test when in either of those tracking states. This is also a best practice.

I hope this information suffices to address your concern to your satisfaction.