谁能解析下这个
NSString *str1 = @"123";
NSString *str2 = @"123";
NSString *str3 = [[NSString alloc] initWithString:str1];
NSString *str4 = [str1 stringByAppendingString:@""];
NSString *str5 = [@"1" stringByAppendingString:@"23"];
NSLog(@"%p, %p", str1, str1.UTF8String); // 0x101710610, 0x10144c4b5
NSLog(@"%p, %p", str2, str2.UTF8String); // 0x101710610, 0x10144c4b5
NSLog(@"%p, %p", str3, str3.UTF8String); // 0x101710610, 0x10144c4b5
NSLog(@"%p, %p", str4, str4.UTF8String); // 0x101710610, 0x10144c4b5
NSLog(@"%p, %p", str5, str5.UTF8String); // 0x608000053cb0, 0x60800009f340
objc_getAssociatedObject(self, key); 相同的NSString的值,通过UTF8 转换为key值就可能得不到自己想要的属性值。