How to change value of mutable string ? Here is what I do
NSString *str = @"This is string";
NSMutableString *str = [NSMutableString stringWithFormat:@"%@", str];
str = @"New string" -> wrong incompatible pointer types assigning to NSMutableString from NSString
You only need to use
NSMutableStringif you want to change parts of the string in place (append, insert etc.), often for performance reasons.If you want to assign new values to the string variable, you’re fine with a good old
NSStringas your last line simple assigns a complete new string object tostr: