本帖最后由 陈志辉 于 2014-4-14 18:23 编辑
#import < Foundation/Foundation . h>
@interface Person : NSObject
-(void) test;
@end
#import "Person .h"
-(void)test
{
NSLog(@"调用了test方法");
}
@end
#import < Foundation/Foundation . h>
#import "Person .h"
int main()
{
Person *person = [Person alloc] init
NSString *str = @" test "; //定义一个方法名的字符串
SEL selsctor = NSSelsctorFromString(str); //将字符串包装成SEL类型
[person performSelsctor : selsctor]; //调用方法
return 0;
}
怎么这段代码报“unrecognized selector sent to instance”错误呢? |