Reputation: 1127
I am working on a health related app. The functionality of the app depends upon health and location services. I'm trying to access the health data permissions (certain parts of the app will be restricted without health data permissions). I've searched on the internet and read apple documentation. I found a function
HKHealthStore().authorizationStatus(for: )
which returns the status of save data to Health app, but that does not work for me. All I need is to read the permissions. How can I access this information?
Any help is greatly appreciated. Thanks :)
Upvotes: 4
Views: 2241
Reputation: 7353
You cannot determine whether your app has read access by design. From the documentation:
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. If your app is given share permission but not read permission, you see only the data that your app has written to the store. Data from other sources remains hidden.
Upvotes: 5