Ryan
Ryan

Reputation: 682

Setting up HealthKit on Independent Apple Watch app

I am creating an independent Apple Watch app that is not linked to an iPhone app. How can I request access to HealthKit data directly from the Apple Watch without requesting the HealthKit data via an iPhone app.

Apple recently announced that developers could now create independent Apple Watch apps in WWDC 2019, but I'm not finding documentation on how to use HealthKit on independent apps. I started following the instructions on this page here

https://developer.apple.com/documentation/healthkit/setting_up_healthkit

but the problem that I'm running into is that I can't figure out how to set the necessary custom messages for NSHealthShareUsageDescription and NSHealthUpdateUsageDescription. Apples documentation says to do this through the Info.plist, but I can't find these options anywhere for the just the Apple Watch.

Can anyone show how to use HealthKit for an independent Apple Watch app?

Upvotes: 1

Views: 414

Answers (1)

Curiosity
Curiosity

Reputation: 264

In Xcode's project navigator on the left, your WatchKit extension group contains the Info.plist where you'll add your NSHealthShareUsageDescription and NSHealthUpdateUsageDescription messages. Add the HealthKit setup and authorization code from the article you linked in say, your extension delegate, and you're good to go.

Upvotes: 1

Related Questions