What is this error? I am using mutable type but still it is not working!
ERROR IS :
Terminating app due to uncaught exception
‘NSInvalidArgumentException’, reason: ‘mutate immutable
object with deleteCharactersInRange:’
NSMutableString *line= [NSMutableString stringWithString:@"here is the string"];
[line deleteCharactersInRange: NSMakeRange(1,9 )];
My new answer:
With your new code, I added one extra line at the end:
And the console output was:
No exception thrown. Looks like it’s working for me!
My original answer (for your original question):
You can’t delete characters from a line that has nothing in it (hence the exception).
Do you have any additional code between those two lines of source there? If not, you have a valid NSMutableString… with nothing in it. And you can’t delete anything from a mutable string that has nothing in it.