Alamofire is the best way to resubmit a request

This is what I need:

  • call post api
  • if success: do nothing
  • if failed (no internet access): put the request on the stack
  • monitor if the network is back.
  • if network is available: try again in this stack

even if the user closes the application, I still need to have an accessible stack. I need to save the stack to disk

Here is what I plan to do:

  • have an apiRequest class, it contains
    • Parameters
    • URL
  • has an apiRequestManager class, it contains
    • apiRequest array

The apiRequest array is stored on disk. Every time the user wants to call api, I first call Alamofire.request, and if that fails, put it in the apiRequest array.

NetworkReachabilityManager , . true, apiRequest. , , . .

, Alamofire. , , Alamofire.

, RequestRetrier. , , , , , , ?

?

.

+4

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


All Articles