You can't convert an NSString
to an NSMutableString
simply by casting. Do this instead:
NSMutableString *string = [self.label.text mutableCopy];
문제
Im inserting a string into a NSMutableString like as
NSMutableString *string = (NSMutableString *)self.label.text;
[string insertString:@"New " atIndex:0];
these line of codes working properly iOS 6 device. but in iOS 7 it throws an exception as Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'
(i'm running ios 6 app in ios 7 device).
can any body tell why it's happening? please.
thanks
해결책
You can't convert an NSString
to an NSMutableString
simply by casting. Do this instead:
NSMutableString *string = [self.label.text mutableCopy];