Try HealthKit with the iOS Simulator without devel

2019-05-20 20:51发布

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?

2条回答
Juvenile、少年°
2楼-- · 2019-05-20 21:48

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.

查看更多
叛逆
3楼-- · 2019-05-20 21:53

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.

查看更多
登录 后发表回答