I am currently chatting a bit with ARC to figure out how to do this before starting to do my job. I installed this code:
NSNumber* n = [[NSNumber alloc] initWithInt:3];
__weak NSNumber* weakN = n;
n = nil;
NSLog(@">>>: %@ %@", n, weakN);
I expected n and weak N to be nil, since n = nil; should cause a surge in my eyes? Unfortunately, this does not happen. The output is "→>: (null) 3". What am I missing here?
Another thing is that I'm sure the code below gave me a hard time starting from the arc:
__weak NSNumber* weakN2 = [[NSNumber alloc] initWithInt:3];
NSLog(@">>>: %@", weakN2);
I am sure I had some problems with similar code, since arc would release the object immediately after initialization, since there is no strong reference to the object. Unfortunately, the exit from the above "→>: 3".
It would be great to get some clarification on this. I am clearly missing something!
Regards, Michael