开发者

Can an Objective-C block object have an associated object?

开发者 https://www.devze.com 2023-02-15 02:03 出处:网络
If it can, are there a开发者_运维问答ny gotchas to using it?Yes you can.I just tried it.This makes sense, since blocks are instances of NSBlock (a private class), which itself inherits from NSObject.

If it can, are there a开发者_运维问答ny gotchas to using it?


Yes you can. I just tried it. This makes sense, since blocks are instances of NSBlock (a private class), which itself inherits from NSObject.

However, my naïve test seemed to indicate that the associated object was not un-associated when the block was deallocated. (Although it's possible that I was never hitting the block's -dealloc method)

I'll keep experimenting and try some more stuff.

0

精彩评论

暂无评论...
验证码 换一张
取 消