-
代码示例如图:
-
声明的
protocol
里的property
是不会自动synthesize
-
这种情况下如果调用
protocol
里的property
,就会因为找不到方法而崩溃 -
警告说明如图: 说明链接
-
警告提示内容
Auto property synthesis will not synthesize property 'title' declared in protocol 'BaseModelProtocol'
- 解决办法:手动实现synthesize
#import "BaseModel.h"
@implementation BaseModel
@synthesize title; /// 手动实现synthesize
@end
- 为了防止遗漏可以参考警告设置(4)进行设置