Che*_*ong 2 delegates class objective-c
我在一个文件中有协议和类头:
@protocol SomethingDelegate
- (void) doSomething;
@end
@interface SomethingClass
@property (nonatomic, weak) id <SomethingDelegate> delegate;
@end
Run Code Online (Sandbox Code Playgroud)
在.m文件中:
@implementation SomethingClass // in here I got error "Cannot synthesize weak property in file using manual reference counting"
@end
Run Code Online (Sandbox Code Playgroud)
如果我把它改成这样:
@implementation SomethingClass
@synthesize delegate; // in here I got error "Cannot synthesize weak property in file using manual reference counting"
@end
Run Code Online (Sandbox Code Playgroud)
为什么会这样?以及如何解决这个问题?如果我从更改错误消失weak来strong.但这不是代表应该如何宣布,对吧?如何正确宣布弱代表?
San*_*ani 18
您需要设置Weak References in Manual Retain Release到YES你Apple LLVM 8.0 - Language - Objective C下Build Settings你的项目,如screenshot-图所示
| 归档时间: |
|
| 查看次数: |
8679 次 |
| 最近记录: |