I would like to test a HealthKit app in the iOS Simulator without an iPhone Developer Account. I added an entitlement file with the com.apple.developer.healthkit capability enabled and when I build the app it seems to include the file in the bundle but then when I try to access the HealthKit API the Simulator throws this error:
Error Domain=com.apple.healthkit
Code=4 "Missing com.apple.developer.healthkit entitlement."
UserInfo=0x7fc939f091c0
{NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
Is there any option to try HealthKit in the iOS Simulator without a Developer Account?
You need to add the entitlement to the project.
Goto Project Settings >> Capabilities
Scroll Down the list to HealthKit
and Turn it ON
If you're testing on a real Device then you also need to add that entitlement from your apple developer account for that specific appID and update Provisioning profile and download it again.
The easiest way is to download the example app from:
https://developer.apple.com/library/ios/samplecode/Fit/Introduction/Intro.html
and play with it.
来源:https://stackoverflow.com/questions/26434322/try-healthkit-with-the-ios-simulator-without-developer-account