A queue for working with iOS similar to the path android priority queue

Does anyone have an iOS workflow similar to the Path Priority Job Queue that they don't mind sharing with the community? I am very new to iOS, so I'm not sure if the platform itself provides such a solution. There is no such thing on android, so I had to use the library, which Path generously provided. If iOS or Xcode has such a solution / API, point it to me. If not, please share yours if you do not mind. Thank.

Basically, I'm looking for a job queue that allows users to send data to the server, even if there is no network: this means that the queue will be stored on the data, even if the user must disconnect the iPhone. And then at a later time, when the system detects the network, push the data to the server.

There is already a similar question in SO, so I will include it in more detail: How to place data for sending a server on Android. The difference is that my question is about iOS, and theirs for Android.

Use case

In my case, it is assumed that the user gets on the train in the subway (no network), but decides to send an email. Then close the application or even turn off the phone. Then, an hour after the user turns on the phone again, when the network is detected, the application sends an email.

+4
source share
2 answers

https://github.com/thisandagain/queue is very promising. He has the ability to repeat and constantly.

+2
source

AFNetworking request operations and the request operation manager can be changed to do this, while not much work.

Necessary changes:

  • When AFHTTPRequestOperationit fails due to lack of connection, make a copy of the operation and save it (for example, in NSArray)
  • Use the built-in reachability manager and retry the operations in the array when accessibility returns
  • Remove operations from the array, if successful.

, . :

  • -copy -copyWithZone: NSURLRequest . , , , .
  • outputStream .
  • completionBlock, self, , .

, , .

+1

Source: https://habr.com/ru/post/1547801/


All Articles