So the auto synthesize of properties is awesome. However, when you provide both a getter and a setter, you get an error.
@property (strong, nonatomic) NSArray *testArray;
- (NSArray *)testArray {
return _testArray;
}
- (void)setTestArray:(NSArray *)testArray {
_testArray = testArray;
}
Error: Use of undeclared identifier '_testArray'
.
Adding @synthesize testArray = _testArray;
solves the problem. I am just wondering why this is?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…