我收到了以下警告:
使用字符串字面量 'stringWithString' 是多余的
在使用方法usingWithString
时出现了这个警告。
[NSString stringWithString:@"Content-Type: content/unknown\r\n\r\n"]
我收到了以下警告:
使用字符串字面量 'stringWithString' 是多余的
在使用方法usingWithString
时出现了这个警告。
[NSString stringWithString:@"Content-Type: content/unknown\r\n\r\n"]
[NSString stringWithString:@"Content-Type: content/unknown\r\n\r\n"]
替换为@"Content-Type: content/unknown\r\n\r\n"
来解决��问题。 NSString *s1 = @"s1";
NSString *s3 = [[NSString alloc] initWithString:@"s1"];
我们可以打印它们的地址:
2017-02-08 11:38:46.997201 Test[7484:2245410] s1:0x10009c088 s1
2017-02-08 11:38:46.997290 Test[7484:2245410] s3:0x10009c088 s1
我们可以发现它们指向同一个地址。因此,苹果建议使用“@”而不是“initWithString”。