8
5

More than 3 years have passed since last update.

HKHealthStoreのデータ読み取り権限があるかチェックする

Posted at

結論から言うと読み取り権限があるかチェックすることはできません。
書き込み権限の有無はauthorizationStatus(for:)でチェックすることができます。

このメソッドのDiscussionに以下の説明がありました。

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. 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.

権限がない場合はデータが取得できないだけだそうです。

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5