- (void)showWeakValue
{
NSString * __weak weakString = [[NSString alloc] initWithFormat:@"First Name: AA"];
NSNumber * __weak weakNum = [[NSNumber alloc] initWithInt:10];
NSLog(@"weakString = %@", weakString);
NSLog(@"weakNum = %@",weakNum);
}
输出是
weakString = (null)
weakNum = 10
为什么weakNum 不为空?因为没有其他强引用weakNum,它应该在分配后立即释放。正确的?