I think this is because when you get into the if statement with weakOne will increment the retain count in autorelease pool; therefore, the weak pointer will not be zero until the autorelease pool drained.
// Try this
NSObject *strongOne = [[NSObject alloc] init];
NSObject * __weak weakOne = strongOne; //count 1
@autoreleasepool {
if (weakOne) {
NSLog(@"weakOne is not nil."); //count 2
} else {
NSLog(@"weakOne is nil.");
}
strongOne = nil; // count 1
if (weakOne) {
NSLog(@"weakOne is not nil.");
} else {
NSLog(@"weakOne is nil.");
}
} // count 0, therefore the weakOne become nil
if (weakOne) {
NSLog(@"weakOne is not nil.");
} else {
NSLog(@"weakOne is nil.");
}