perfood / capacitor-healthkit

Capacitor plugin to interact with HealthKit
https://www.npmjs.com/package/@perfood/capacitor-healthkit
54 stars 41 forks source link

Request authorization silent? #24

Open kyllerss opened 1 year ago

kyllerss commented 1 year ago

I am having a difficult time getting Apple HealthKit integration to work. Even though I have been following the documented basic example for requesting authorization (ie. CapacitorHealthkit.requestAuthorization), I have been unable to to trigger the confirmation screen to pop up.

Assuming I have followed the instructions as provided, is there some else I should be doing to enable Apple HealthKit integration in my app (any settings, etc)? Perhaps there is some build setting that needs to be enabled? Any suggestions as to what I should try to troubleshoot this issue?

Thanks!

mahnuh commented 1 year ago

Hi @kyllerss, please provide a repo where I can reproduce this issue. Otherwise it is hard to help, because things should work if you followed the docs.

kyllerss commented 1 year ago

Found the issue. I had added the capabilities manually (the instructions state that as an alternative to using the UI). However when I did it through the UI, I found that it modified some additional configuration files around entitlements that made the approval popup work. I think the instructions should state that the UI is required (or document the additional files that need to be modified). The additional files that I found to be modified were:

I am no iOS developer, so perhaps the problem is with a flawed workflow on my part. Hope this helps anyone else who runs into this issue!

The Podfile may have been the result of forgetting to run npx cap sync ios (not sure if I'd forgotten to do that initially).