Keep blocks inside a dictionary

后端 未结 4 542
不知归路
不知归路 2020-12-14 11:00

I have my own method that takes a block as an argument. I want to keep track of that block inside an NSDictionary. What is the best way to add the block to the dictionary?

4条回答
  •  独厮守ぢ
    2020-12-14 11:08

    Actually with ARC you can simply add the block to the NSDictionary as you would with any other object. You do not need to do anything special like Block_copy or [block copy], and doing that would be wrong and will cause a leak.

提交回复
热议问题