NSString initialization and memory management, nsstring Initialization
1. NSString three initialization Methods
A. Direct Value assignment: NSString * str = @ "a string", which uses constant memory.
B. Use the class method: NSString * str = [NSString stringWithString: @ "a string"];
NSString * str = [NSString stringWithFormat: @ "age is % I, height is % f", 20,180];
C. Use the instance method: NSString * str = [[NSString alloc] initWithString: @ "a string"];
NSString * str [[NSString alloc] initWithFormat: @ "age is % I, height is % f", 20,180];
2. NSString Memory Management
Use Xcode 6.1.1 to test and create a new NSString. We found that the initWithString and stringWithString that were not warned in Xcode4.6 will both be reported as follows. Du Niang found that there is an answer, the reason is that the new version of Xcode has been optimized, which means this writing method is redundant. We recommend that you write it in a format like 'nsstring * str =, in this way, the memory of str will be opened directly from the constant memory area.
Reference: http://www.cnblogs.com/celestial/archive/2012/10/10/2719169.html
Http://www.cnblogs.com/hellocby/archive/2012/08/23/2652201.html
To be supplemented...