GregWilson / react-native-apple-healthkit

A React Native bridge module for interacting with Apple HealthKit data
176 stars 42 forks source link

is it possible to use `authorizationStatus(for:)` ? #7

Closed tsugitta closed 7 years ago

tsugitta commented 7 years ago

https://developer.apple.com/reference/healthkit/hkhealthstore/1614154-authorizationstatus

README saids

For any data that is read from HealthKit the status/error is the same for both. This privacy restriction results in having no knowledge of whether the permission was denied (make sure it's added to the permissions options object), or the data for the specific request was nil (ex. no steps recorded today).

but I think if I can know whether the permission was denied or the data was nil by using authorizationStatus(for:). so I wish I could use this.. is it implemented?

thanks.

tsugitta commented 7 years ago

sorry I didn't read apple's document well.

ApolloMuses commented 7 years ago

@tsugitta Can you explain how you got around this? I'm pretty new to RN and am trying to figure this out too...thanks!

tsugitta commented 7 years ago

@kh1990 I created this issue because I think it's possible to know whether the user's reading permission is denied or not by using authorizationStatus(for:) . but I figured out it's impossible as Apple says

This method checks the authorization status for saving data.

To help prevent possible leaks of sensitive health information, your app cannot determine whether or not a user has granted permission to read data. If you are not given permission, it simply appears as if there is no data of the requested type in the HealthKit store.

I closed this issue because I'd just like to get reading permission and it turned out impossible, but someone may need authorizationStatus(for:) to get saving permission (but it can be gotten by current library's saving method because it should show errors when saving).

ApolloMuses commented 7 years ago

Ahh I understand your original comment now. Yeah i wonder if it can be tested say saving a 0.0001 step add? and then deleting it? lol