react-native-fitness icon indicating copy to clipboard operation
react-native-fitness copied to clipboard

iOS: isAuthorized does not work

Open m-ruhl opened this issue 4 years ago • 4 comments

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

m-ruhl avatar Dec 01 '20 10:12 m-ruhl

hello @m-ruhl, did you find any solution for this issue ?

NguyenHoangMinhkkkk avatar Apr 12 '21 01:04 NguyenHoangMinhkkkk

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

TheRogue76 avatar Jul 14 '21 06:07 TheRogue76

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.

darrenmerrett avatar Sep 18 '21 20:09 darrenmerrett

Also check this issue with workaround: https://github.com/OvalMoney/react-native-fitness/issues/50

rlems avatar Nov 15 '21 10:11 rlems