3

Are HealthKit permissions needed from BOTH iOS and WatchOS?

I'm requesting authorization from watchOS which in-turn guides user to open the iOS app to acquire permissions. To transfer information I am using WatchConnectivity by creating a WCSession between the two devices.

Is it enough to present permissions from watch only?

Cœur
  • 37,241
  • 25
  • 195
  • 267
as diu
  • 1,010
  • 15
  • 31

1 Answers1

2

Your iOS app must implement applicationShouldRequestHealthAuthorization(_:) in its application delegate and call handleAuthorizationForExtension(completion:) on an HKHealthStore to complete the authorization request made by your iOS app. More details are available in the documentation here.

Allan
  • 7,039
  • 1
  • 16
  • 26
  • Thank you @Allan that was exactly what I was looking for. Earlier I was requesting permissions on both ends and it was a hot mess. Thanks again! – as diu Jun 25 '17 at 23:29
  • The row "Privacy - Health Share Usage Description" must be set in the info.plist of your iOS app with a description string in order to make this work. Also the health kit must be added to the capabilities of the iOS app. If you don't do this the access rights can be manually granted by the user using the health app. Unfortunately this is not properly documented. – Benedikt S. Vogler Jun 06 '19 at 17:30