Obj-C: [NSString stringWithString:@"string"] vs. @"string"

cocoa-touch, ios, nsstring, objective-c, stringwithstring

Solution

Actually there is no difference. `[NSString stringWithString: str]` just does nothing and returns `str` if `str` is immutable already.

Problem

I've seen people do something like `[NSString stringWithString:@"some string"]`. Why not just do `@"some string"`? For an example, look at the `facebook-ios-sdk`. +[NSString stringWithString:] -- what's the point? is a similar question, but none of the answers address `[NSString stringWithString:@"some string"]` vs. `@"some string"`.

Original source

Related problems