I found strange behavior when working with a property that was inherited as readonly and than redeclared in an inherited class like readwrite
In Ah
@interface A : NSObject
@property (nonatomic, strong, readonly) NSObject * someProperty;
@end
In bh
@interface B : A
- (void)foo;
@end
In bm
@interface B()
@property (nonatomic, strong, readwrite) NSObject * someProperty;
@end
@implementation B
- (void)foo {
NSLog(@"%@", self.someProperty);
self.someProperty = [NSObject new];
}
@end
call
self.someProperty = [NSObject new];
causes code failure on unrecognized selector "setSomeProperty:"
the study showed that it seems that the setter did not receive synthesis, even if it is declared as readwrite
Why is this happening? The compiler did not indicate any warnings that this would happen, and I did not find that this behavior was logged.