开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜