Last Updated: February 25, 2016
·
767
· gamugamu

copy on mutable ivar @synthesized is not a mutable copy

@property(nonatomic, copy)NSMutableArray* marray;
/* */
@synthesize m
array;

/* */

self.m_array = [NSMutableArray array]; // is wrong, will give NSArray

So you need to make custom accessor:

@property(nonatomic, retain /mutableCopy/)NSMutableArray* m_array;

/* */

@synthesize m_array; // synthesize getter.

// custom setter:

  • (void)setMarray:(NSMutableArray*)array{ [marray autorelease]; m_array = [array mutableCopy]; }