OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
341 stars 68 forks source link

iOS: isAuthorized does not work #88

Open m-ruhl opened 3 years ago

m-ruhl commented 3 years ago

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

NguyenHoangMinhkkkk commented 3 years ago

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

TheRogue76 commented 2 years ago

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

darrenmerrett commented 2 years ago

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.

rlems commented 2 years ago

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