Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加 _UIAlertControllerTextField 到白名单,以修复 UIAlertViewController 添加 TextField 文本输入框时的误报。 #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TinyQ
Copy link

@TinyQ TinyQ commented Jan 31, 2018

当在执行下面后,关闭弹出的 Alert ,会报内存泄漏。
代码如下:

    UIAlertController *alter = [UIAlertController alertControllerWithTitle:@"Title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    }];
    UIAlertAction *cancle = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    UIAlertAction *delete = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:nil];
    [alter addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
    }];
    [alter addAction:sure];
    [alter addAction:cancle];
    [alter addAction:delete];
    [self presentViewController:alter animated:YES completion:^{
        
    }];

泄漏提示:

2018-01-31 16:58:53.940825+0800 Demo[78899:4176582] Possibly Memory Leak.
In case that _UIAlertControllerTextField should not be dealloced, override -willDealloc in _UIAlertControllerTextField by returning NO.
View-ViewController stack: (
    UIAlertController,
    "_UIAlertControllerView",
    UIView,
    "_UIAlertControllerInterfaceActionGroupView",
    UIView,
    "_UIInterfaceActionGroupHeaderScrollView",
    UIView,
    UIView,
    UICollectionViewControllerWrapperView,
    UICollectionView,
    "_UIAlertControllerTextFieldViewCollectionCell",
    UIView,
    "_UIAlertControllerTextFieldView",
    UIView,
    UIView,
    "_UIAlertControllerTextField"
)

@cddjr
Copy link

cddjr commented Feb 10, 2018

16年的pr #28 已经作出了类似调整,但一直没被合并

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants