What is the difference between these two ways of creating NSStrings?
- by adame
NSString *myString = @"Hello";
NSString *myString = [NSString stringWithString:@"Hello"];
I understand that using method (1) creates a pointer to a string literal that is defined as static memory (and cannot be deallocated) and that using (2) creates an NSString object that will be autoreleased.
Is using method (1) bad?
What are the major differences?
Is there any instances where you would want to use (1)?
Is there a performance difference?
P.S. I have searched extensively on Stack Overflow and while there are questions on the same topic, none of them have answers to the questions I have posted above.