Tell me more ×  What's the difference between NSString *myString
= @"Johnny Appleseed" versus NSString *myString = [NSString
stringWithString: @"Johnny Appleseed"]?  Where's a good case to
use either one?  share|improve this question add comment  4
Answers  up vote 3 down vote accepted  In the first case, you
are getting a pointer to a constant NSString. As long as your
program runs, myString will be a valid pointer. In the second,
you are creating an autoreleased NSString object with a constant
string as a template. In that case, myString won't point to a
real object anymore after the current run loop ends.  Edit: As
many people have noted, the normal implementation of
stringWithString: just returns a pointer to the constant string,
so under normal circumstances, your two examples are exactly the
same. There is a bit of a subtle difference in that Objective-C
allows methods of a class to be replaced using categories and
allows whole classes to be replaced with class_poseAs. In those
cases, you might run into