iosobjective-cmethodscompletionhandlercompletion-block

Objective C completion block doesn't get called


I am trying to call a completion block in a unit test but it never reaches. Here is the code:

[vc configureRecorder:^{
    NSLog(@"Completion...");
}];

This is the method:

-(void)configureRecorder:(void(^)(void))callback {
    NSLog(@"Method");
}

Solution

  • You need to call the completion block at the end of your method. like this:

    -(void)configureRecorder:(void(^)(void))callback {
        //@"Method"
        callback()
    }