我UIAlertController通过UIViewController使用以下方法创建类别来添加我的应用程序:
- (void)showAlertViewWithTitle:(NSString *)title
message:(NSString *)message
actions:(NSArray *)alertActions
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title ? : @"" message:message preferredStyle:UIAlertControllerStyleAlert];
if (alertActions.count) {
for (UIAlertAction *action in alertActions) {
[alertController addAction:action];
}
} else {
UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:action];
}
[self presentViewController:alertController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
起初,一切看起来都很棒但是当我用Instruments分析泄漏时,每次调用这个方法时,都会出现一些泄漏:

以下是调用的showAlertViewWithTitle:message:actions:方法
[self showAlertViewWithTitle:nil message:@"Test message" actions:nil];
Run Code Online (Sandbox Code Playgroud)
知道为什么我得到所有这些泄漏?
- 编辑 -
我在一个示例项目中尝试了以下内容:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"message"
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
Run Code Online (Sandbox Code Playgroud)
我得到了同样的泄漏.我真的不确定发生了什么......