今天在使用協議的過程中,偶然發現這樣使用
@interface AppDelegate (){ idtestdelegate; } @property (nonatomic , assign) id testdelegate; @end @implementation AppDelegate @synthesize testdelegate;
Existing instance variable 'delegate' for property 'delegate' with assign attribute must be unsafe unretained
修改成:
@interface AppDelegate (){ __unsafe_unretained idtestdelegate; } @property (nonatomic , assign) id testdelegate; @end @implementation AppDelegate @synthesize testdelegate;