Multiple request with AFNetworking

前端 未结 2 523
我在风中等你
我在风中等你 2021-02-10 00:31

I\'m trying to do multiple request in background to download many jsons and check data from them but I don\'t know how to use AFNetworking in that case.

I tried to do li

2条回答
  •  醉话见心
    2021-02-10 01:25

    AFNetworking will definitely handle this. We use it for exchanging data with a RESTful set of services. The things to keep in mind:

    • An operation (eg. AFHTTPRequestOperation) can only be used once.
    • An operation is asynchronous.
    • Put your operations in an NSOperationQueue, or use AFHTTPClient (suggested) to manage the operations for you.
    • When sending multiple requests, always assume that the responses will come back in a random sequence. There is no guarantee that you will get the responses in the same sequence as the requests.

    Hope this helps to point you towards a solution to your problem. Without more detail in your question, it's difficult to give you a specific answer.

提交回复
热议问题