代码如下:
Person 类中有如下方法:
@implementation Person
- (void)test2
{
NSLog(@"test2 ---");
}
@end
main函数函数如下:
int main()
{
SEL s2 = NSSelectorFromString(name);
[p performSelector:s2]; //此行警告“performSelector may cause a leak because its selector is unknown”警告
[p performSelector:@selector(test2)];// 这样用就没有警告
[p test3:@"asafasdf"];
SEL s3 = @selector(test3:);
[p performSelector:s3 withObject:@"123"]; //同样的警告“performSelector may cause a leak because its selector is unknown”
return 0;
}
上面的警告是什么原因呢? |
|