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

Use hooks to add HealthKit entitlement #79

Open
sgilroy opened this issue Oct 30, 2016 · 2 comments
Open

Use hooks to add HealthKit entitlement #79

sgilroy opened this issue Oct 30, 2016 · 2 comments

Comments

@sgilroy
Copy link
Contributor

sgilroy commented Oct 30, 2016

The readme for this plugin instructs the developer to manually add the HealthKit entitlement when adding the plugin.

Make sure your app id has the 'HealthKit' entitlement when this plugin is installed (see iOS dev center).

For my app, we clean and rebuild the cordova platforms every time we build, so this means that we have to manually go into Xcode and add the HealthKit entitlement each time, which is time consuming and error prone.

As an example, it looks like the cordova-universal-links-plugin adds the entitlements it needs via hooks:
https://github.com/nordnet/cordova-universal-links-plugin/tree/master/hooks

Note that the HealthKit plugin.xml file does include the framework

<framework src="HealthKit.framework" weak="true" />

However, I believe the entitlement is not added automatically (despite this comment: #15 (comment)).

@ijansch
Copy link

ijansch commented Nov 17, 2016

We were able to do this sort of automatically by upgrading to cordova-ios 4.3, which ensures that the xcode project gets an entitlement file. We then used this post-prepare hook to add the capability:

#!/bin/bash
PLIST=platforms/ios/*/Entitlements-Debug.plist
cat << EOF |
Add :com.apple.developer.healthkit bool YES
EOF
while read line
do
/usr/libexec/PlistBuddy -c "$line" $PLIST
done

true

This adds the capability to the plist file (you'd have to do the same for Release). Still it would be great if the plugin does this automatically.

@rupalpatel0008
Copy link

I am also having this same issue.

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

3 participants