简体   繁体   English

HealthKit 请求授权失败

[英]HealthKit request authorization failing

I continue to receive this error when I request authorization.当我请求授权时,我继续收到此错误。

Error Domain=com.apple.healthkit Code=5 "Transaction block failed without an error."错误 Domain=com.apple.healthkit Code=5 “交易块失败,没有错误。” UserInfo={NSLocalizedDescription=Transaction block failed without an error.} UserInfo={NSLocalizedDescription=事务块失败且没有错误。}

I have tried re-adding and removing: Privacy - Health Update Usage Description , Privacy - Health Records Usage Description , Privacy - Health Share Usage Description我已经尝试重新添加和删除: Privacy - Health Update Usage DescriptionPrivacy - Health Records Usage DescriptionPrivacy - Health Share Usage Description

I have tried removing the HealthKit entitlement and adding it again.我已尝试删除 HealthKit 权利并再次添加它。 This flow worked previously, so I have no idea what is going on.这个流程以前有效,所以我不知道发生了什么。 Deleting and reinstalling app does not fix the problem either.删除并重新安装应用程序也不能解决问题。

The HealthKit UI just never shows. HealthKit UI 永远不会显示。 Checking the privacy settings doesn't show I've ever requested either.检查隐私设置也没有显示我曾经请求过。

final class HealthStore {
    
    private let healthStore = HKHealthStore()

    func requestAuthorization() {
        let objectTypes: Set<HKObjectType> = [
            .activitySummaryType()
        ]
        
        healthStore.requestAuthorization(toShare: nil, read: objectTypes) { (success, error) in
            print("success = \(String(describing: success))")
            print("error = \(String(describing: error))")
        }
    }
}

In a sample application this code works just fine.在示例应用程序中,此代码可以正常工作。 I think HealthKit has gotten into a bad state.我认为 HealthKit 陷入了糟糕的 state。

I don't know the underlying problem, but restarting my Mac and my iPhone solved the problem.我不知道根本问题,但重新启动我的 Mac 和 iPhone 解决了这个问题。

You change your IP and the network.您更改 IP 和网络。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apple HealthKit 授权不起作用(Xcode 13.3) - 提示授权请求失败 - Apple HealthKit authorization not working (Xcode 13.3) - FAILED prompting authorization request 有没有办法使用 HealthKit 在 iOS 上请求对非临床和临床记录的授权? - Is there a way to request authorization for both nonclinical and clinical records on iOS with HealthKit? 如何撤销HealthKit授权 - How to revoke HealthKit Authorization 在HealthKit中请求授权:为什么结果总是成功? - Requesting authorization in HealthKit: why the result is always successful? 已授予HealthKit授权并可以在模拟器上工作,但不能在实际设备上工作 - HealthKit authorization granted and working on simulator but not on actual device HealthKit requestAuthorization返回代码100:“授权会话超时” - HealthKit requestAuthorization returns code 100: “Authorization session timed out” 如何为HKWorkout类型请求HealthKit权限? - How to request HealthKit permissions for HKWorkout type? Apple Health Kit错误Domain = com.apple.healthkit代码= 5“未确定授权” - Apple Health Kit Error Domain=com.apple.healthkit Code=5 “Authorization not determined” 授权给HealthKit时出错-Code = 100“不支持回滚运行状况数据库。” - Error while authorization to HealthKit - Code=100 “Rolling back the health database is unsupported.” 使用HealthKit检索SleepAnalysis后,仍然出现此“授权未确定”错误 - After using HealthKit to retrieve SleepAnalysis, I still get this Authorization Not Determined error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM