In the iOS app that I’m working on now, we have a problem that I’ve never seen in my years as an iOS programmer.
While we have a 99.7% crash free user experience, what does crash is weird as fuck.
By that, I mean that data that normally exists in a dictionary most of the time suddenly becomes nil.
It was today when I noticed this.
@property(strong, nonatomic, readwrite,getter=getRootAPIData) NSDictionary *rootUrlMap;
See how we have an accessor defined for rootUrlMap to be getRootAPIData? (Yes, that get is bad form, i know.)
Well, we never use it.
We always access it like so, [AppEnvironment sharedEnvironment].appContext.rootUrlMap;
And there is only one instance of getRootAPIData in the app… where it is defined.
And here’s my question. Would directly accessing the property via the property name, even when its getter is defined to be something else, would this occasionally result in a nil return?
So, what happens when you define a getter of an object’s property to be something else, yet still try to get a value from the name of the property?
We have a lot of sloppy programming, including a lot of the hacky safeObjectForKey: to prevent crashing when accessing a value from a dictionary when you assume that the dictionary is not nil and I’m trying to sort out all this slop.
Thanks in advance,