开发者

Autorelease NSString

开发者 https://www.devze.com 2023-01-12 18:42 出处:网络
A开发者_JAVA技巧m I responsible for releasing this string, and is it autorelease by default? // command is of type NSData*

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消