研究了以下法典,并假设该守则是在阿拉伯研究中心下汇编的:
- (void)foo { NSOperationQueue *oq = [[NSOperationQueue alloc] init]; [oq addOperationWithBlock:^{ // Pretend that we have a long-running operation here. }]; }
尽管作业地点被宣布为当地变量,但其寿命只要运行,就继续超出该方法的范围。
如何做到这一点?
<><>UPDATE:
我赞赏大家深思熟虑的评论,但我认为我没有正确地问我的问题。 我并不是要问一个具体的问题,即乌克兰行动,而是关于阿农发委员会中物体寿命的一般问题。 具体地说,我的问题是:
我是一位方案家,时间很长,我非常清楚这种事情的陷阱。 我不想说这是好还是坏的想法。 我认为,这总的来说是坏的。 相反,我的问题是学术问题: 无论它是否具有良好或坏的思想,ARC如何做到这一点,以及具体辛迪加如何这样做?