2

我想在没有 iPhone 开发者帐户的情况下在 iOS 模拟器中测试 HealthKit 应用程序。我添加了一个启用了 com.apple.developer.healthkit 功能的授权文件,当我构建应用程序时,它似乎将文件包含在包中,但是当我尝试访问 HealthKit API 时,模拟器会抛出此错误:

Error Domain=com.apple.healthkit
Code=4 "Missing com.apple.developer.healthkit entitlement."
UserInfo=0x7fc939f091c0
{NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}

在没有开发人员帐户的情况下,是否可以在 iOS 模拟器中尝试 HealthKit?

4

2 回答 2

3

您需要将权利添加到项目中。

Project Settings >> Capabilities

向下滚动列表 HealthKit并打开它ON

如果您在真实设备上进行测试,那么您还需要从您的苹果开发者帐户中为该特定 appID 添加该权利,并更新配置文件并再次下载。

于 2014-11-28T13:34:33.330 回答
1

最简单的方法是从以下位置下载示例应用程序:

https://developer.apple.com/library/ios/samplecode/Fit/Introduction/Intro.html

和它一起玩。

于 2014-10-17T23:53:04.413 回答