简体   繁体   中英

What does Core Motion error 102 mean?

I use Core Motion's sensor fusing to get north oriented motion updates:

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXTrueNorthZVertical toQueue:motionQueue withHandler:motionHandler]

In a very rare case that can be reproduced only on selected customer devices (iPhone 4S running iOS 6.0.2) I receive this error in the motionHandler:

Error Domain=CMErrorDomain Code=102 "The operation couldn’t be completed. (CMErrorDomain error 102.)

Also, it seems I don't get any valid deviceMotion updates after that. Does anybody know what this error 102 means? I can't find anything in the documentation.

As Krishnabhadra correctly pointed out, this error code means CMErrorTrueNorthNotAvailable . The description ("True north is not available on this device. This usually indicates that the device's location is not yet available.") unfortunately doesn't give any hint how to solve the issue so I'd like to describe my findings when this error occurs.

It occurs on a tiny (a handful out of many thousands) fraction of iOS 6.0+ devices when using CMAttitudeReferenceFrameXTrueNorthZVertical ( CMAttitudeReferenceFrameXMagneticNorthZVertical is OK). Despite the error description, Core Location works correctly. On affected devices the bug is triggered in 100% of the cases and blocks Core Motion updates completely. -[CMMotionManager deviceMotion] always returns nil .

Resetting the iOS system settings fixes the problem.

I've logged rdar://12952327 with some more details.

Update: This error occurs if compass calibration is disabled in the privacy / location services / system services section.

From documentation

typedef enum {
   CMErrorNULL = 100,
   CMErrorDeviceRequiresMovement,
   CMErrorTrueNorthNotAvailable
} CMError;

It seems error 102 is CMErrorTrueNorthNotAvailable , and its description is

CMErrorTrueNorthNotAvailable

It seems not much information is available regarding what causes this error. It can be any hardware issue with the device.

Also, make sure this is enabled. After I enabled this option, I did not encounter the 102 issue anymore while using xTrueNorthZVertical.

Settings > Privacy > Location Services > System Services > Compass Calibration

iOS 11系统服务

102 is CMErrorTrueNorthNotAvailable. I guess that your device has problems with determining north direction or something.

我收到此错误,当我试图找到解决方案时,显然我的设备中的位置服务已关闭,一旦我打开,它就可以了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM