在没有开发人员帐户的情况下,使用iOS模拟器尝试He​​althKit

我想在iOS模拟器中testingHealthKit应用程序,而无需iPhone开发人员帐户。 我添加了启用了com.apple.developer.healthkitfunction的授权文件,当我构build应用程序时,似乎将该文件包含在软件包中,但是当我尝试访问HealthKit API时,Simulator会引发此错误:

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

有没有任何选项可以在没有开发人员帐户的情况下在iOS模拟器中尝试HealthKit?

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

转到Project Settings >> Capabilities

将列表向下滚动到HealthKit并将其ON

如果您在真实设备上进行testing,则还需要从您的Apple开发人员帐户中为该特定的appID添加该授权,然后更新供应configuration文件并再次下载。

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

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

并玩它。

Interesting Posts