PermissionScope icon indicating copy to clipboard operation
PermissionScope copied to clipboard

Use CMSensorRecorder for statusMotion in iOS9

Open jbarmanet opened this issue 8 years ago • 3 comments

With Swift3 + XCode8 + iOS10 the MotionPermission() works fine, however when checking for the permission.statusMotion() it always return Unknown even if the permission was accepted... Is that a known issue?

For now I found a workaround by using the new iOS9 CMSensorRecorder feature, that has a very straightforward CMSensorRecorder.isAuthorizedForRecording() -> Bool that will let us know if MotionPermission was granted. Maybe worth to add it into PermissionScope? CMSensorRecorder Reference

jbarmanet avatar Oct 05 '16 23:10 jbarmanet

Motion status is async iirc. Might be related to how PS' handles async permissions requests (#133)

Could you submit a PR using isAuthorizedForRecording with availability checking ? (Since it's iOS 9+). The API is ambiguous though, it doesn't differentiate between unknown/unauthorized so we'd have to use the UserDefaults approach

bre7 avatar Oct 11 '16 23:10 bre7

Until 10.3 the CMSensorRecorder workaround was working, but since the iOS 10.3 update it does not seem to work anymore, and return false even if the authorization was given… Any updates on this issue in PermissionScope?

jbarmanet avatar Apr 03 '17 21:04 jbarmanet

+1

nitinalabur avatar Jun 27 '17 02:06 nitinalabur