HealthKit错误:缺少com.apple.developer.healthkit授权 [英] HealthKit error: Missing com.apple.developer.healthkit entitlement
问题描述
我在iOS Swift应用中添加了HealthKit的代码,但出现错误:
I'm adding code for HealthKit in my iOS Swift app, but I'm getting an error:
/* Ask for permission to access the health store */
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
if HKHealthStore.isHealthDataAvailable(){
healthStore.requestAuthorizationToShareTypes(typesToShare,
readTypes: typesToRead,
completion: {(succeeded: Bool, error: NSError!) in
if succeeded && error == nil{
println("Successfully received authorization")
} else {
if let theError = error{
println("Error occurred = \(theError)")
}
}
})
} else {
println("Health data is not available")
}
}
发生错误=错误Domain = com.apple.healthkit代码= 4丢失"com.apple.developer.healthkit权利."UserInfo = 0x7fa748534b00{NSLocalizedDescription =缺少com.apple.developer.healthkit权利.}
Error occurred = Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x7fa748534b00 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
如何解决这个问题?
推荐答案
我花了3天的时间来找出问题所在.我通过以下步骤找到了解决方案:
I spent 3 days trying to figure out what was the problem. I found the solution with those steps:
- 首先进入项目(如图中所示)
- 打开项目和目标列表
- 选择nameApp WatchKit扩展
- 转到功能"选项卡,在Health Kit中按,然后瞧……它对我有用.
我正在使用iOS 9.3.2和Xcode 7.3.1
I am using iOS 9.3.2 and Xcode 7.3.1
这篇关于HealthKit错误:缺少com.apple.developer.healthkit授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!