I have a class ‘Order’, for which I have declared the following property with synthesized accessor methods:
@property (nonatomic, copy) NSMutableArray *lineItems;
@synthesize lineItems = lineItems_;
In another class method I perform the following:
foundOrder = [[Order alloc] init];
NSLog(@"Got %@", [[self getOrderLineItemsForOrderPK:orderPK] class]);
[foundOrder setLineItems:[self getOrderLineItemsForOrderPK:orderPK]];
NSLog(@"Output %@", [[foundOrder lineItems] class]);
The results of which are:
Got __NSArrayM
Output __NSArrayI
Why is my getter returning an immutable array when I set with a mutable?