RMUniversalAlert
RMUniversalAlert copied to clipboard
__weak RMUniversalAlert *weakAlert = alert 的bug
alert.alertController = [UIAlertController showAlertInViewController:viewController
withTitle:title message:message
cancelButtonTitle:cancelButtonTitle
destructiveButtonTitle:destructiveButtonTitle
otherButtonTitles:otherButtonTitles
tapBlock:^(UIAlertController *controller, UIAlertAction *action, NSInteger buttonIndex){
if (tapBlock) {
//the var ‘weakAlert’ is nil
tapBlock(alert, buttonIndex);
alert = nil;
}
}];
i think you can do this:
Hi - what version of iOS are you running this on and seeing the fault?
can you try version 0.8.1 and let me know if it's better? thanks
hi, i use ios 9.2 and ios 10. i'm use version 0.8.1 find this bug. i found the alert object in tapBlock is nil by debug. i think, if user cancel the alert, the alert object retain will -1, so, the alert object retain is 0.
@ryanmaxwell Hi, in 0.8.1 issue of "alert is nil" is obv fixed ..but you brought back retain cycle. alert retains link of alertcontroller -> which holds link to alert via tapBlock. Right now dealloc never called. You have to do at least this "if (tapBlock) { tapBlock(alert, buttonIndex); } alert = nil;"
@alexburkhay thanks if you can submit a PR that fixes the retain cycles and nil alert that would be appreciated.
@iphilcc @ryanmaxwell @alexburkhay I fix the issues in the pr . Has anyone can review my code?