示例代码:
@property (nonatomic) NSDictionary *t
- (instancetype)init {
self = [super init];
if (self) {
self.t = @{@"a": @"b", @"c": @"d"};
}
return self;
}
- (void)testMethod {
//self.t is released! accessing self.t cause an SIGABRT
}
问题是:这段代码出了什么问题?
使用“复制”
时效果很好self.t = [@{@"a": @"b", @"c": @"d"} copy];
OR
@property (nonatomic, copy) NSDictionary *t