main.h
#import <Foundation/Foundation.h>
#import "Person.h"
int main(int argc, const char * argv[])
{
// 开发中遇到的最多的错误
// reason: '-[Person test]: unrecognized selector sent to instance 0x1003006b00'
// 给Person对象发送了一个不能识别的消息:test
Person *p = [Person new];
// OC弱语法体现:编译连接只会警告,不报错,但是运行程序崩溃(闪退)
[p test];
return 0;
}
// 弱语法
Score.h
#import <Foundation/Foundation.h>
@interface Person : NSObject
- (void)test;
@end
Score.m
#import <Score.h>
@implementation Person
// - (void)test
// {
// NSLog(@"123123");
// }
@end