Error occurred = Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x7fa748534b00
{NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
今天在做heathkit开发时遇到了以上的错误提示。
百度出来的一个老外的解释:http://stackoverflow.com/questions/25993314/how-to-solve-this-error-with-healthkit
具体如下:
|
Both of the above answers should be tried first. If however
- You're sure the capability has been activated
- You're confident your app id associated with your provisioning profile has healthkit turned on and matches the app's bundle id
Then try and force the build to use that specific provisioning profile by selecting your target and going to
build settings -> code signing -> provisioning profile
and selecting it manually.
I've run into cases where get the above error in debug if 'automatic selection' is being used
|
上面的解释在我的问题里也行得通。
我的做法是:
第一步,检查下图的第1项,必须位ON;下图第2项所列的4步steps都打勾,不存在打红 X的情况。
授权
为了使用HealthKit,你必须为HealthKit授权。
依然是在Target栏中,打开Capabilities菜单,将HealthKit这一部分的开关设为ON的状态,如屏幕截图中显示那样:

![]()
第二步,就是检查你的App 的 ID 和 team。
![]()
即:
在项目导航栏中选择我们的项目名,选择Target。然后选择General菜单,将Bundle Identifier改为你自己的名字或者是域名。
然后,在Team组合框中选择与你的开发者账号关联的开发团队。
