本文共 542 字,大约阅读时间需要 1 分钟。
比如如下代码:
-(void)performSelector:(SEL)selector onNode:(CCNode *)node withObject:(id)object recursive:(BOOL)isRecursive{ if ([node respondsToSelector:selector]) { [node performSelector:selector withObject:object]; } if (isRecursive) { for (CCNode *child in node.children) { [self performSelector:selector onNode:child withObject:object recursive:YES]; } }}
在其中
[node performSelector:selector withObject:object];
一句会出现may cause a leak的错误:
你可以安全的忽略该错误,只要node上执行的selector不会返回一个指针或id类型.