为什么代码给出错误 - 尝试使用 appendFormat: 改变不可变对象?
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
for (NSTextTestingResult *match in matches) {
<omitted>
NSMutableString *value;
value = (NSMutableString *)[response stringWithRange:range];
if ([dict objectForKey:@"traveler"])
[dict objectForKey:@"traveler"] appendFormat:@"%@", value]; // Errors here
[dict setObject:value forKey:key];
}
价值被创造为_NSCFString
.