I am calling a block with a boolean value. According to the debugger, the boolean value is false, but it seems to be treated as true. Is this a compiler/Xcode bug, or am I supposed to mark the parameters being passed to a block in some way similar to __block?
// Hovering over the |finished| parameter displays the value of finished as NO
[self.repDataSynchronizationClient synchronizeWithRepId:rep.id andCompletion:^(NSString * progressMessage, BOOL finished){
if( finished )
{
[self hideLoader]; // Breakpoint set here, which I am hitting
}
else
{
[self setLoaderTitle:progressMessage];
}
}];
Here’s a screenshot of the situation, with the breakpoint hit and tooltip displayed.
If you are in release rather than debug, there is a strong probability that it just the breakpoints that are wrong. This is presumably due to the complier removing some statements in release as in optimises and line numbers no longer lining up with the code they are supposed to.
Verify which clause your if statement is reaching with
NSLogstatements instead.On a separate note, you mention the use of
__block, but don’t actually use it and appear to have a retain cycle there. It should probably read:If using ARC, use
__unsafe_unretainedinstead of__block.