Re: NSMutableArray Problem

2008-02-21 Thread Keith Duncan
Now, that being said, I'm not sure why you're getting the warning about distinct ObjC types. An API expecting an NSArray can be passed an NSMutableArray, the converse however isn't true. Casting the return value of - componentsSeparatedByString: to a mutable array won't make it one. Keith

Re: NSMutableArray Problem

2008-02-21 Thread Shamyl Zakariya
To use it as a mutable array, you will have to create a mutable array from the vanilla array returned by componentsSeparatedByString. E.g. NSMutableArray *listItems = [NSMutableArray array]; [listItems addObjectsFromArray: [list componentsSeparatedByString:@", "]]; Now, that being said, I'

Re: NSMutableArray Problem

2008-02-21 Thread Hank Heijink
componentsSeparatedByString returns an NSArray, not an NSMutableArray. You'll need to make a mutableCopy, like so: NSMutableArray *listItems = [[[list componentsSeparatedByString:@","] mutableCopy] autorelease]; If you don't autorelease your mutable array here, you'll have to release it y

NSMutableArray Problem

2008-02-21 Thread Philip Bridson
Hi Guys, I'm trying to do this: NSString *list = @"wrenches, hammers, saws"; NSArray *listItems = [list componentsSeparatedByString:@", "]; Which is straight out of the documentation and I want to use a Mutable Array instead, but I get this warning: warning: initialization from distinct Ob