B
B
boobooking2018-03-25 22:21:00
Swift
boobooking, 2018-03-25 22:21:00

How to execute several asynchronous tasks sequentially using GDC?

GDC is great at helping you perform asynchronously independent tasks. But I had an inverse problem - I need to execute several asynchronous tasks in sequence, and I powerfully blunted at this stage.
Briefly, the task is this.
1) The application is subscribed to update information in Apple Health.
2) I myself add several records to Apple Health (API adding asynchronous)
3) I still do not have time to process the response about the record in Health, as I already receive updated information from Health. And this information (in fact, data about my own transaction) begins to conflict with my incomplete process.
I need to receive the received notification from Apple Health, but queue it up and start processing it only after I receive the completion handler from the record in Apple Health.
I'm trying to add the write task and the response from Health to one serial queue. But that doesn't solve the problem. It is necessary to somehow slow down the processing of this queue until the completion handler is processed from writing to Health.
Please suggest me how to resolve this situation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Glueckskind, 2018-03-26
@Glueckskind

Google towards Dispatch Groups. You can start from here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question