I read on the web that when I create an object with alloc
and init
I have to release it (even a NSString
), so:
Why if I create a NSString
this way:
NSString *prova = [[NSString alloc] init];
[prova release];
I get these errors:
'release' is unavailable: not available in automatic reference counting mode
and
ARC forbids explicit message send of 'release'
on the [prova release]
message? I get no error when I try do this:
NSString *prova = [[NSString alloc] init];
NSLog(@"Contenuto 0 di prova: %@", prova);
prova = @"prima prova stringa";
NSLog(@"Contenuto 1 di prova: %@", prova);
prova = @"ma cosè questo fantomatico errore";
NSLog(@"Contenuto 2 di prova: %@", prova);