ARSCNView creation hanging & ARSession Error 102 - "Required sensor failed"

I'm current running iOS 13 Beta 3. This is happening on my XS Max I use for development, but it can happen on other models and OS versions too.


When creating ARSessions, mostly when using an ARFaceTrackingConfiguration but to a lesser extent with an ARWorldTrackingConfiguration, one of two things happen.


1) The code hangs during the call to create the ARSCNView() instance, requiring a reboot of the phone before this will work again, or

2) I get an error from the ARSession error handler "func session(_ session: ARSession, didFailWithError error: Error)" reporting "Required sensor failed"


I keep resetting the session via the following code fragment recommended in other threads:

let configuration = ARFaceTrackingConfiguration()

configuration.worldAlignment = .gravity

//configuration.worldAlignment = .gravityAndHeading

arSceneView.session.pause()


arSceneView.session.run(configuration, options: [

.resetTracking,

.removeExistingAnchors])
I've tried everything mentioned in the forums here and that I've found via Google searches, including during the reset:

  • Setting configuration.worldAlignment to .gravity, which fares no better than .gravityAndHeading
  • Setting the just-mentioned settings before the initial call to create the session configuration doesn't help either.
  • Turning Compass Calibration on the phone either on or off
  • Verifying that the proper Location settings are enabled and tested in the code prior to setting up the session, and all of the proper text string combinations are set for Location Always, When in Use, and Always and When in Use
  • Verifying in settings that Location services are on and that Location for the app is set to Always


If I have the app just keep endlessly resetting the session, eventually it works (unless the ARSCNView creation fails and a reboot is required), sometimes on the first try and sometimes on the Nth try (even a dozen or more) one or two minutes later, so it really can't be due to any permission setting on the phone or it would always fail.


Rebooting the phone may help a little, but sometimes it will do the session failure even on the first run after a reboot. Running builds in either Release or Debug, with or without XCode, don't appear to make any difference.


I'm at wits end and have to assume others are still running into this even though there aren't any recent posts on the topic.


Does anyone have any suggestions?

Replies

Here's an interesting update.


I've downloaded the Apple-provided ARKitFaceExample and it exhibits the same problem. There were no edits made other than setting the signing team for the build.


This seems to be a problem in iOS 13 Beta 3. I'm also using the corresponding XCode Beta 3 Anyone else seeing the same and even better, figure out a workaround?


Also FYI: Since their own sample app is showing this problem too, I've filed an official bug report using the Feedback too. If you are struggling with this too please do the same to help make the problem more visible.

I've been seeing the "required sensor failed" error message consistently now in iOS 13 beta 3 / Xcode 11 beta 3 too (I'm doing ARKit face tracking using the front-facing True Depth camera). Will file a radar.

Thank you for the input! I've rolled the phone back to Beta 2 and the problem is minimal there. Sometimes it requires one reset but even then that is pretty quick and not the 5 to 6 seconds for as many as 20 resets before clearing in Beta 3,

This appears to have been largely resolved in the second Beta 3 release 17A5522g (vs 17A5522f).


Sometimes a single reset is still required but it happens quickly. The reset works fine even with a .gravityAndHeading configuration setting.

I'm also seeing this as having been fixed in the second release of beta 3 (17A5522g).