对象被释放了,它们仍然给出了它们的值。ARC 未标记(表示关闭)
-(void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//test of retain and copy
NSString *s1 = [[NSString alloc] initWithString:@"String1"];
NSString *s2 = [s1 copy];
[s1 release];
[s1 release];
[s2 release];
if(s1!=nil)
{
NSLog(@"11111");
NSArray *array = [[NSArray alloc] initWithObjects:@"1",@"2",@"3", nil];
[array release];
NSLog(@"S1 - %@ \n S2 - %@ \n Array - %@",s1,s2,array);
}
}
===输出===
2012-12-14 15:04:01.165 testMM[940:207] 11111 2012-12-14 15:04:01.168 testMM[940:207] S1 - String1 S2 - String1 数组 - S1 - String1 S2 - String1 数组 -