Better way to run multiple HealthKit sample queries?

后端 未结 3 1522
花落未央
花落未央 2021-01-14 14:30

I have a scenario where I need to retrieve multiple sets of data from HealthKit -- body temperature, weight, and blood pressure. I need all 3 before I can continue processin

3条回答
  •  太阳男子
    2021-01-14 14:50

    I ran into this same problem, and a much better approach for any kind of nested async call would be to use GCD's dispatch groups. These allow you to wait until multiple async tasks have completed.

    Here's a link with an example: Using dispatch groups to wait for multiple web services

提交回复
热议问题