ios - enableBackgroundDelivery(对于 :frequency:withCompletion:) HealthKit

标签 ios swift healthkit

我已经为 HealthKit 数据和所需的一切启用了后台传送。唯一让我困惑的是,当健康应用程序有一些更新时,我会在哪里收到通知。在 enableBackgroundDelivery 方法的完成处理程序中或在应用程序启动时在应用程序委托(delegate)中。

最佳答案

补全只给出enable是否成功,来自Doc HealthKit

HealthKit wakes your app whenever new samples of the specified type are saved to the store. Your app is called at most once per time period defined by the specified frequency.

As soon as your app launches, HealthKit calls the update handler for any observer queries that match the newly saved data. If you plan on supporting background delivery, set up all your observer queries in your app delegate’s application(:didFinishLaunchingWithOptions:) method. By setting up the queries in application(:didFinishLaunchingWithOptions:), you ensure that the queries are instantiated and ready to use before HealthKit delivers the updates.

关于ios - enableBackgroundDelivery(对于 :frequency:withCompletion:) HealthKit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48670418/

相关文章:

healthkit - 通过 REST API 查询 HealthKit 数据

ios - 在 HealthKit 中保存锻炼

ios - 如何在 Cocoa Touch 中任意两个 ViewController 之间转换?

ios - UITableViewController 不会用 NSFetchedResultsControllerDelegate + UISearchBarDelegate 更新

ios - 当应用程序在后台或被杀死时,GCM 支持 ios 应用程序

ios - Swift 3 - 直接打开 App Store 评论选项卡(不是 iTunes Store 评论选项卡)

swift - 如何将元组加在一起

ios - 在为其设置的时间之前触发所有待处理的通知

ios - 代码错误 : linker command failed with exit code 1 googletoolboxmac

ios - 如何从 Apple Watch 获取实时健康更新,将其与健康工具包同步并发送到服务器?