bluefloyd8
bluefloyd8

Reputation: 2276

Autorelease NSString

Am 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];

Upvotes: 1

Views: 3020

Answers (2)

diederikh
diederikh

Reputation: 25271

It's autoreleased by default. Retained objects are usually created with methods in the form of:

[[MyClass alloc] ...]
[MyClass new] 
[object copy]

Upvotes: 3

kubi
kubi

Reputation: 49354

Autoreleased by default.

Upvotes: 4

Related Questions