I have this method which takes a block, but that block isn't always called. See the method:
- (void)updateWithCompletion:(void (^)(void))completion {
[MYObject myMethodWithCompletion:^(NSArray *array, NSError *error) {
if (error) {
NSLog(@"%s, ERROR not nil", __FUNCTION__);
completion();
return;
}
NSLog(@"%s, calling completion %d", __FUNCTION__, &completion);
completion();
NSLog(@"%s, finished completion", __FUNCTION__);
}];
}
I have some more NSLogs inside completion. Sometimes this program counter just blows right past the call to completion() in the code above. I don't see why this would be as the calling code always passes a literal block of code as input.
If you're curious of the output of the line containing the addressof operator, it's always something different, but never 0 or nil.
What would cause completion not to be executed?