Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How send request with AFNetworking 2 in strict sequential order?

I'm doing the sync to mirror a sqlite DB to a server one.

I have a Master-Detail table, where the details must be send to the server ASAP. However, is possible that detail 3 arrive before detail 2. I need to mimic the steps made to the document and respect the order of the operations.

When a record is saved locally, I send a notification and then post the data. How I can guarantee a strict sequential order using AFNetworking?

like image 241
mamcx Avatar asked Oct 02 '22 16:10

mamcx


1 Answers

By default, operations run concurrently, with no guarantee of order. The only way to ensure that actions play is to prevent more than one request operation from running at a given time, by setting the operationQueue.maximumConcurrentOperations property to 1 (or, if you're not using a manager, make sure to enqueue operations into an operation queue with the property set thusly).

like image 89
mattt Avatar answered Oct 06 '22 05:10

mattt