I have a read only property
@property (nonatomic, readonly) NSInteger keepalive;
With a getter method
-(NSInteger)keepalive
{
return _keepalive / 1000;
}
ERROR - Use of undeclared identifier
And trying to set a value in init
method
- (instancetype)init
{
self = [super init];
if (self)
{
_keepalive = 25000;
}
return self;
}
ERROR - Use of undeclared identifier
Couldn't understand the reason why and what's the right way to have a readonly property, with a getter.
EDIT:
I wouldn't want to add synthesize
as suggested in the comment, since it's not needed anymore - as stated here AND I got the correct answer below.
Thank you André Slotta!