Download a file / image with AFNetworking in iOS?

后端 未结 2 1902
醉梦人生
醉梦人生 2020-12-05 00:58

I thought I had it figured out but I just can\'t get it to work. I have a method that is called on every URL in an array. This method have a URL of a picture that should be

2条回答
  •  我在风中等你
    2020-12-05 01:40

    The problem here is, the operation is not retained. It will be deallocated immediately.

    Either make the operation a property of your class or let a operation queue (also a property) handle the request for you (recommended). In the latter case don't call [operation start]. When you use AFHTTPClient the operation queue will also be managed for you.

    Also you should register a completion callback for the request operation (setCompletionBlockWithSuccess:failure:).

提交回复
热议问题