getter method for property crashes with EXC_BAD_ACCESS

exc-bad-access, getter-setter, ios, objective-c

Solution

I think you might be getting a Stack Overflow! because the line

if(!self.someProperty)

will be calling

- (NSString *) someProperty

recursively until the recursion stack overflows.

Similarly if it could get to the return line, it would do the same thing.

Problem

I've declared a property someProperty and synthesized it: @synthesize someProperty = _someProperty; But when I call it in code, I get EXC_BAD_ACCESS in my getter overide method. Why?? ``` - (NSString *) someProperty { <---EXC_BAD_ACCESS HERE if(!self.someProperty) return self.someOtherProperty; return self.someProperty; } ```

Original source