I do not know when I need to copy a block.
The documentation says when you expect the block to be used after destruction of the scope within which it was declared .
Do I need to copy it when I use them as callback methods? By copy, I mean creating a copy property for my block and saving the block there or sending it. The scope is likely to be destroyed when the download or the like ends. So what do I need to copy a block in this case? Can I create circular links this way?
Now I have a loader class (only for checking blocks, it is too dangerous for me to use it yet) that uses a completion block, and when I copy the block, the view controller that created the block and the loader class are not released.
Can you give me some good examples, especially using them to complete asynchronous operations such as downloading files?
Thanks.
source share