The problem is I don't see the benefit of using associated objects vs static objects defined in the category implementation file with getter/setter methods.
I was thinking about defining the getters and setters in the header file of the category. Like this:
@interface NSObject (test_static)
- (id)getStaticObject;
- (void)setStaticObject:(id)a_static;
@end
and then to declare a static variable in the implementation file and implement getter/setter methods, like this:
static id test;
@implementation NSObject (test_static)
- (id)getStaticObject
{
return test;
}
- (void)setStaticObject:(id)a_static
{
test = a_static;
}
Why I shouldn't use this approach and use associated objects instead ?
Well, I guess I didn't get how properties work and how they've solved the fragile base class problem. Maybe it's related...