当我尝试删除之前保存在HealthKit中的一些记录时,如果我使用-deleteObjectsOfType:predicate:withCompletion:
,则会出错。错误说:
Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.healthd.server" UserInfo={NSDebugDescription=connection to service named com.apple.healthd.server}
但是,如果我首先使用相同的类型和谓词查询记录,然后使用-deleteObjects:withCompletion:
删除返回的样本。它有效。
这是类型和谓词,如果它有帮助:
HKCategoryType *type = [HKCategoryType categoryTypeForIdentifier:HKCategoryTypeIdentifierMenstrualFlow];
NSPredicate *predicate = [HKQuery predicateForObjectsFromSource:[HKSource defaultSource]];
有人有同样的问题吗?感谢。