Reputation:
I try to replace a object in a NSMutableArray. To figure out, what the index number is, I use following code:
NSUInteger index = [self.nameArray indexOfObject:[NSString stringWithFormat:@"James"]];
Now I try to replace it:
self.nameArray = [[NSMutableArray alloc] replaceObjectAtIndex:index withObject:@"Johanna"];
But even I want to start the app, I will become an error: Assigning to 'NSMutableArray *' from incompatible type 'void'
Upvotes: 0
Views: 748
Reputation: 9589
Below code is helpful for you.
[self.nameArray replaceObjectAtIndex:index withObject:@"Johanna"];
Upvotes: 2
Reputation: 385500
I think this is what you want to do:
[self.nameArray replaceObjectAtIndex:index withObject:@"Johanna"];
Upvotes: 1