react-native-fitness
react-native-fitness copied to clipboard
iOS: isAuthorized does not work
Hello,
I was trying to see if the user, has given the app the permissions..
I think the wrong method is used: https://github.com/OvalMoney/react-native-fitness/blob/3fdf681cd7122c8b7007640e83def9bab6fabfdc/ios/RCTFitness/RCTFitness.m#L133
Because HKAuthorizationRequestStatus
is compared against HKAuthorizationStatus
https://developer.apple.com/documentation/healthkit/hkauthorizationrequeststatus?language=objc
This method to my understanding only returns, if a popup will appear on requesting the permission, but won't tell if the app is authorised or not.
I think this method, is the right one https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus
But as the documentation states.. it will only work on write
not for read
Greets Michael
hello @m-ruhl, did you find any solution for this issue ?
Having the same issue. Once the pop up is shown, the isAuthorized method will always return true even if the user has denied those permissions
This is in the docs...
Fitness.requestPermissions([{ kind: int, access: int }]) Ask permission and return if user granted or not(Android), while, due to Apple's privacy model, always true is returned in iOS.
Also check this issue with workaround: https://github.com/OvalMoney/react-native-fitness/issues/50