Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request authorization silent? #24

Open
kyllerss opened this issue May 30, 2023 · 2 comments
Open

Request authorization silent? #24

kyllerss opened this issue May 30, 2023 · 2 comments

Comments

@kyllerss
Copy link

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
Copy link
Collaborator

mahnuh commented May 30, 2023

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
Copy link
Author

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:

  • app/main/native/capacitor/ios/App/App/App.entitlements:
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array/>
  • app/main/native/capacitor/ios/App/Podfile:
 pod 'PerfoodCapacitorHealthkit', :path => '../../node_modules/@perfood/capacitor-healthkit'

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

@kyllerss kyllerss reopened this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants