block的循环引用问题啊亲!

坑了一波爹的问题就是太久没有写iOS的代码,写block的时候竟然忘记了换循环引用的问题,聊以自喂吧。

__weak typeof(self) weakSelf = self;
__weak typeof(webView) weakWeabView = webView;
    
    [roundMenu setButtonClickBlock:^(NSInteger idx) {
        
        NSLog(@"button %@ clicked !",@(idx));
        switch (idx) {
            case 0:
                [weakSelf sharToWeChatButtonPress];
                break;
            case 1:
                [weakWeabView reload];
                break;
            case 2:
                [weakSelf.navigationController popToRootViewControllerAnimated:YES];
                break;
            default:
                break;
        }
    }];

你可能感兴趣的:(block的循环引用问题啊亲!)