5 Replies
      Latest reply on Jul 17, 2018 7:38 PM by faingold
      swissdev Level 1 Level 1 (0 points)

        Hi

         

        We have a problem with our app when starting on an iPhone X.

        As soon as we run the ARKit Session with .gravityAndHeading on, it fails with:

         

        session did fail with error: Error Domain=com.apple.arkit.error Code=102 "Required sensor failed." UserInfo={NSLocalizedFailureReason=A sensor failed to deliver the required input., NSUnderlyingError=0x1d02415c0 {Error Domain=CMErrorDomain Code=102 "(null)"}, NSLocalizedRecoverySuggestion=Make sure that the application has the required privacy settings., NSLocalizedDescription=Required sensor failed.}

         

        If we only set it to .gravitiy. It works.

        What causes this issue. We have added all privacy flags and it still does not work.

         

        CoreLocation and the camera is accepted as well.

         

        We have a second iPhone X and it works there.

         

        Does anybody have the same issue?

        • Re: ARKit Error: A sensor failed 102
          peterdev Level 1 Level 1 (0 points)

          Same issue here on a iPhone 7 plus, no problems on a 5SE. workaround for me is:

           

              func session(_ session: ARSession, didFailWithError error: Error) {      

                  switch error.code {

                  case 102:

                      configuration.worldAlignment = .gravity

                      restartSessionWithoutDelete()

                  default:

                      restartSessionWithoutDelete()

                  }

              }

           

              @objc func restartSessionWithoutDelete() {

                  self.sceneView.session.pause()

                  self.sceneView.session.run(configuration, options: [

                      .resetTracking,

                      .removeExistingAnchors])

              }

          • Re: ARKit Error: A sensor failed 102
            Bobjt Apple Staff Apple Staff (70 points)

            Did this error start after iOS 11.2? There was bug fixed in 11.2 so that Core Location more accurately reports heading availability. This would mean that you wouldn't receive the ARSession error prior to 11.2, but would still not get a pose (because, heading isn't available). What would help the Core Location team diagnose this problem is if you could file a bug report and include an iOS sysdiagnose (scroll down the list here to find steps to do this).

              • Re: ARKit Error: A sensor failed 102
                ktopits Level 1 Level 1 (0 points)

                I have seen this since at least 11.1, still getting it in 11.3.  As mentioned, disabling compass (heading orientation) and restarting gets around issue.  In 11.3 beta there is more Apple generated logging, which indicates there was a [Sensor] code=101 "Device Orientation Error" which leads to a [Session] code=102 "Required Sensor failed".  The "NSLocalizedRecoverySuggestion="Make sure that the application has the required privacy settings." is incorrect and this is not a privacy issue.

                 

                This is common in my downtown office building.  The magnetic signal to the compass is mostly noise (we spent a lot of time on another project doing indoor navigation, and found a lot of reasons for magnetic compass failure).  So I get the error pretty consistantly on 5th gen iPad (seems to have a poor magnetometer) and often on iPadPro.  But the iPhone X and iPhone7+ seem to have much better magnetometers, and only fail when obviously close to interference - like big monitors or electronics.  I have never had the error occur outdoors. So error essentially means "compass can not find magnetic north" (magnetometer checked all directions, and the signal is too weak, or results are inconclusive).

                 

                Usually the error occurs at session startup, although I have have seen several times where it occured minutes after session startup.

                 

                2018-01-31 18:09:30.012695-0500 SBD Measure[1445:102791] [Sensor] Device orientation error: Error Domain=CMErrorDomain Code=101 "(null)"

                2018-01-31 18:09:30.015986-0500 SBD Measure[1445:102791] [Session] Session (0x101048300): did fail with error: Error Domain=com.apple.arkit.error Code=102 "Required sensor failed." UserInfo={NSLocalizedFailureReason=A sensor failed to deliver the required input., NSUnderlyingError=0x1c0e41890 {Error Domain=CMErrorDomain Code=101 "(null)"}, NSLocalizedRecoverySuggestion=Make sure that the application has the required privacy settings., NSLocalizedDescription=Required sensor failed.}