Why should we copy blocks rather than retain?

憶江南的部落格發表於2015-10-14

Why should we copy blocks rather than retain?



3
down voteacce

Because when you create a block there is nothing to retain, since it doesn't exist in the heap until you copy it there with Block_copy. This is covered in the WWDC lectures about blocks. However, as of iOS 6 they are treated as regular objects so you don't need to worry. After you copy them you can retain them as you please.


相關文章