performselector参数生命周期问题

来源:互联网 发布:娱乐圈爆料知乎 编辑:程序博客网 时间:2024/06/07 08:25

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

method. After that, I don't need the array anymore in my method that calls this performSelector:withObject:afterDelay:.

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.

0 0
原创粉丝点击