문제

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];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top