Why would an instance of NSMutableArray be immutable?


James Walker
 

I was trying to add an object to an array and got an exception saying that I was trying to modify an immutable object. I set a breakpoint just before the addObject: line, and said to lldb

po [formatsOfSize isKindOfClass: [NSMutableArray class]]

and the reply was '\x01'. So it should be mutable, no? Is there a better run-time test for mutability?

If it's a clue,

po [formatsOfSize class]

produced

__NSCFArray
.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.