Memory leaks 忽略[NSTimer scheduled…]方法';返回值是多少?
我只想在几秒钟后做一次简单的配餐,只做一次。我写道:Memory leaks 忽略[NSTimer scheduled…]方法';返回值是多少?,memory-leaks,automatic-ref-counting,nstimer,Memory Leaks,Automatic Ref Counting,Nstimer,我只想在几秒钟后做一次简单的配餐,只做一次。我写道: [NSTimer scheduledWimerWithTimeInterval:seconds target:self selector:@selector(someMethod:) userInfo:nil
[NSTimer scheduledWimerWithTimeInterval:seconds
target:self
selector:@selector(someMethod:)
userInfo:nil
repeats:NO];
并且不考虑返回值
可以吗?在someMethod:
完成操作后,是否会释放并取消分配被忽略的NSTimer对象?请参见“计时器编程主题”中的:
因为运行循环维护计时器,从
对象生命周期通常不需要保留对对象的引用
在你安排好时间后计时
中的第一个代码示例几乎是
与您的相同,并且忽略返回值。谢谢!我使用NSTimer的方法非常简单,以至于我还没有读过文档。。。