I have a NSString with numbers e.g.”1,3,6,7″
and a global NSMutableArray that is initialized elsewhere.
Now to get the numbers from the string to the Array I thought something like this would work:
[myMArray arrayByAddingObjectsFromArray:([myString componentsSeparatedByString:@","])];
but it doesn’t work. Can someone explain me why?
The method arrayByAddingObjectsFromArray returns a new, autoreleased,
NSArrayobject. It looks like you’re assuming it adds objects to an existingNSMutableArray. You should use theaddObjectsFromArray:(NSArray*)method instead.