0
votes

This is my error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance

I have no idea why this is happening. Both the array (which is NSMutableArray) and the object being added are definitely not nil, and the @property for the array is straight up (nonatomic, retain).

Can anyone help?

1

1 Answers

3
votes

Chances are the array is not a NSMutableArray - a NSArray is not mutable, that is, you cannot add objects to it.

I know you said it is - but if you do

NSMutableArray* someArray = [NSArray array];

you get a NSArray, not a NSMutableArray. I've done it.