I am encountering a problem with HealthKit authorization in my app. In a previous version of the app, write permission for HKWorkoutType was already granted. In the new version of the app, I added a request for read permissions for both HKWorkoutType and HKWorkoutRoute.
After updating the app, the following occurs:
I can successfully fetch workout data using HKSampleQuery, and authorizationStatus(for: HKObjectType.workoutType()) returns .sharingAuthorized, indicating that the app has access to the data. However, when I check the Health app (Settings -> Health -> Data Access & Devices -> [App Name]), the read permission does not appear in the list. The write permission is still visible, but the newly requested read permission is missing. This behavior is unexpected because, despite being able to access the data programmatically, the read permission is not listed in the Health app settings. I have already verified that I am requesting the read permissions correctly in the code using requestAuthorization for both HKObjectType.workoutType() and HKObjectType.seriesType(forIdentifier: .workoutRoute).
I would appreciate guidance on why this issue is occurring and how to ensure that read permissions are displayed correctly in the Health app settings.