简体   繁体   中英

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");
}

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM