kingleekong
3/21/2018 - 8:54 AM

attribute

attribute(cleanup)

#define onExit __strong void(^block)(void) __attribute__((cleanup(blockCleanUp), unused)) = ^
static void blockCleanUp(__strong void(^*block)(void)) {
    (*block)();
}
- (void)initUI
{
  onExit 
  {
    NSLog(@"clean up clearly");
  }
}