Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

[Enhancement] OrientationSensor documentation for iOS needs location service note #1473

@skorpsim

Description

@skorpsim

Summary

I had a Xamarin.Forms App that read Accelerometer, Gyroscope and OrientationSensor. On Android everything worked as expected. On iOS only the OrientationSensor did not provide updates. Not a single update was received. Beside the missing updates there was nothing that indicated the error.

The issue was that, in the Xamarin.Essentials source code DataUpdated method of OrientationSensor.ios.watchos.cs was called once and provided a NSError object. This error is not relayed. The error description is:

Error Domain=CMErrorDomain Code=102 "Failed to get true north."
UserInfo={NSLocalizedRecoverySuggestion=Location Services must be available and enabled for System Services >
Compass Calibration., NSLocalizedDescription=Failed to get true north., NSLocalizedFailureReason=Unable to access location.}

Turns out that Location Services must be available and enabled for System Services >
Compass Calibration. This is because CMAttitudeReferenceFrame.XTrueNorthZVertical is dependant on the compass calibration.
All other CMAttitudeReferenceFrame enum values (XArbitraryZVertical, XArbitraryCorrectedZVertical, XMagneticNorthZVertical) are not dependant on compass calibration.

Documentation Changes

[iOS specific OrientationSensor setup]
Location Services must be available and enabled for System Services >
Compass Calibration.

Additional Information

Tested on iOS 14.0.1 (iPhone 8) and iOS 12.4.8 (iPhone 6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions