私はiPhoneプログラミングのための初心者です。私はNSStringを扱っています。私は下で説明する疑いがある。
@implementation Sample;
NSString *str;
-(void)viewDidLoad
{
str = [[NSString alloc] initWithString:@"Hello"];
// Why retain count is some random value? (Eg.2147234)
NSLog(@"retain count of string %d",[str retainCount]);
[str release];
}
-(void)printString
{
// Why the value for "str" getting printed here,
// though its released in viewDidLoad?
NSLog(@"string is %@",str);
}