gpt4 book ai didi

ios - HealthKit 数据在后台无法访问

转载 作者:可可西里 更新时间:2023-11-01 03:08:51 60 4
gpt4 key购买 nike

我想使用后台提取在后台提取 HealthStore 数据,但我不断收到错误消息:Error Domain=com.apple.healthkit Code=6 "Protected health data is inaccessible"UserInfo=0x17026fdc0 {NSLocalizedDescription=Protected无法访问健康数据

Apple 声明:

Because the HealthKit store is encrypted, your app cannot read data from the store when the phone is locked. This means your app may not be able to access the store when it is launched in the background.

有什么解决方法可以在后台访问数据吗? HKObserverQuery 是后台获取数据的唯一方式吗?

最佳答案

正如您引用的文档中所述,手机处于锁定状态时无法访问 HealthKit 数据。但是,如果手机已解锁并且您的应用程序在后台运行,您就可以访问数据。因此,如果在手机解锁时发生后台提取,您将能够访问数据。

关于ios - HealthKit 数据在后台无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30361033/

60 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com