I have created a class which has a static NSMutableArray, I want this array to be filled with each instance of the class, during my override of init so I don't have to do anything more coding than I need to.
I should point out the array works perfectly, I am just having trouble storing the correct data.
Does this make sense? If so how can I do this?
Although I have tried doing this
_instance = self;
[[MyClass getStack] addObject:_instance];
It seems I cannot access the instances of the property, and when logged all I get is:
2012-07-14 22:37:58.223 Application[4497:1bb03] <MyClass: 0x92cfc70>
Edit with more code:
My .h file:
@interface MyClass : NSObject
+ (NSMutableArray *)getStack;
My .m file:
@interface MyClass ()
@end
static NSMutableArray *stack;
@implementation MyClass
Edit with image of crash
When logging the array property NSLog(@"%@", [[[MyClass stack] objectAtIndex:0] adam]); It crashes on that line and gives me the following error.
