copy on mutable ivar @synthesized is not a mutable copy
@property(nonatomic, copy)NSMutableArray* marray;
/* */
@synthesize marray;
/* */
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]; }
Written by Loïc
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#