How send request with AFNetworking 2 in strict sequential order?

送分小仙女□ 提交于 2019-12-21 16:56:34

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/21585471/how-send-request-with-afnetworking-2-in-strict-sequential-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!