【问题标题】:How can i delete multiple objects from HKHealthStore?如何从 HKHealthStore 中删除多个对象?
【发布时间】:2014-10-01 20:39:29
【问题描述】:

我知道有这些方法,根据Apple HealthKit Docs

Working with HealthKit Objects

deleteObject:withCompletion:
saveObject:withCompletion:
saveObjects:withCompletion:

我正在寻找这样的东西: deleteObjects:withCompletion:

或者一种从HKHealthStore 中删除多个对象而无需多次调用deleteObject:withCompletion: 的方法。

【问题讨论】:

  • 为什么不用t you want to call it multiple times? You could do it with a for loop, count the number of calls of the completion function, and once it reaches the number of objects you wanted to delete, call the real`补全函数。

标签: ios ios8 healthkit hkhealthstore


【解决方案1】:

在 iOS 8 中,删除多个对象的唯一方法是多次调用 deleteObject:withCompletion。但是,在 iOS 9 中,有两种新方法可用于一次删除多个对象。尝试使用deleteObjects:withCompletion:deleteObjectsOfType:predicate:withCompletion:

【讨论】:

    猜你喜欢
    • 2018-08-07
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-18
    相关资源
    最近更新 更多