I have tried to initialize my NSMutableArray 100 ways from Sunday, and NOTHING is working for me. I tried setting it equal to a newly allocated and initialized NSMutableArray, just allocating, initializing the variable by itself, every combination I could think of and always the same result.
Here's the code:
Object.h
NSMutableArray *array;
@property (copy) NSMutableArray *array;
Object.m
@synthesize array;
if ( self.array ) {
[self.array addObject:anObject];
}
else {
self.array = [NSMutableArray arrayWithObjects:anObject, nil];
}
NOTE: In debug "anObject" is NOT nil at time of execution...
I have tested anObject and it isThe initialization works just fine, but I keep getting the error below when I try to addObject: to self.array.
2010-07-10 11:52:55.499 MyApp[4347:1807] -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x184480
2010-07-10 11:52:55.508 MyApp[4347:1807] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x184480'
Does anyone have any idea what's going wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…