Using 'stringWithString:' with a literal is redundant

4 Solutions Collect From Internet About “Using 'stringWithString:' with a literal is redundant”

The warning is saying that you could instead easily do like this:

statusString = @"Not Reachable";

The explanation is provided in the post
Obj-C: [NSString stringWithString:@"string"] vs. @"string"

Instead of using

statusString = [NSString stringWithString: @"Not Reachable"];

please write your code like below:

statusString = @"Content-Type: Not Reachable/unknown\r\n\r\n";

warning will be removed.

You resolve these ‘warnings’ simply by declaring your strings like so:

statusString = @"";

instead of

statusString = [NSString stringWithString:@""];

I think this is a type of compiler optimization. Actually you need to assign a string to variable. You can do it directly as myString = @"" no need to call a method and it will use additional processing time.