自iOS11.3起,我的AR测量应用程序收到了大量新的崩溃报告。
崩溃说明说: 例外类型:SIGABRT 异常代码:0x181b112ec处的#0 崩溃的线程:0 特定于应用程序的信息:***由于未捕获的异常'std :: invalid_argument'而终止应用程序,原因是:'extrinsicTransform必须具有行列式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)
进行了检查,该应用仍会显示相同的崩溃:(
答案 0 :(得分:2)
感谢您的帮助。我发现在执行hitTest之前检查trackingState可以解决崩溃问题。所以基本上,我正在检查:
if (_arsnView.session.currentFrame.camera.trackingState!=ARTrackingStateNormal)
{
// do not perform hitTest
}
else
{
// perform hitTest
}
在此示例中,_arsnView是类ARSCNView
中的属性答案 1 :(得分:1)
有人为11.3记录了这个错误吗?尝试在iPhone X上使用11.3测试应用程序时获得相同的效果
答案 2 :(得分:0)
我为早先的一个道歉,昨晚我太沉睡了。
无论如何,我为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.