本文介绍了在将对象传递给-performSelector:withObject:afterDelay之前,是否必须保留一个对象:?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在一个方法中创建一个NSArray,所以当我完成它时,我必须放弃它。我将此数组传递给
I am creating an NSArray inside a method, so I have to give it up with release when I'm done with it. I pass this array to the
- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay
方法。在那之后,我不再需要在调用这个performSelector的方法中使用数组:withObject:afterDelay:。
method. After that, I don't need the array anymore in my method that calls this performSelector:withObject:afterDelay:.
该文档没有说明anArgument是否会保留,所以我想知道我是否必须自动发布或保留它以保持活力。您怎么看?
The documentaton doesn't say if anArgument is going to be retained, so I wonder if I had to autorelease it or retain it in order to stay alive. What do you think?
推荐答案
方法保留他们的接收器和参数。
The performSelector methods retain their receiver and argument.
这篇关于在将对象传递给-performSelector:withObject:afterDelay之前,是否必须保留一个对象:?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!