Autorelease NSString
A开发者_JAVA技巧m I responsible for releasing this string, and is it autorelease by default?
// command is of type NSData*
char cAddress[12];
[command getBytes:cAddress range:NSMakeRange(5,12)];
NSString *someString = [NSString stringWithCharacters:(const unichar*)cAddress length:12];
Autoreleased by default.
It's autoreleased by default. Retained objects are usually created with methods in the form of:
[[MyClass alloc] ...]
[MyClass new]
[object copy]
精彩评论