问题描述
我不知道自己在做什么错,因为我无法在模拟器上测试我的应用。如果可能的话,怎么办?请赐教。
for sampleType in identifier
{
let tempQuantityType = HKObjectType.quantityType(forIdentifier: sampleType)!
self.healthStore.enableBackgroundDelivery(for: tempQuantityType,frequency: .immediate) { (success,error) in
if let error = error {
print("\(error)")
}
}
let query = HKObserverQuery(sampleType: tempQuantityType,predicate: nil) { (output,completionHandler,error) in
self.updateLocalData(sampleType: tempQuantityType){
completionHandler()
}
}
healthStore.execute(query)
}
finished()
}
我做错了吗?
func updateLocalData(sampleType: HKQuantityType,completionHandler: @escaping () -> Void) {
HealthData.getMostRecentSample(for: sampleType) { (sample,error) in
if let tempSample = sample {
self.handleNewData(newData: tempSample)
{
loadPreferences()
}
}
completionHandler()
}
}
我遵循this教程以在应用程序处于前台时获取数据 我撞墙了,好几天都没有进步。请告诉我我所缺少的。谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)