泄漏与UIAlertController

我添加UIAlertController在我的应用程序通过创buildUIViewController类别与以下方法:

 - (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]; } 

起初,一切看起来不错,但是当我用仪器分析泄漏时,每次我调用这个方法时,都会出现一些泄漏:

在这里输入图像说明

以下是如何调用showAlertViewWithTitle:message:actions:完成的

 [self showAlertViewWithTitle:nil message:@"Test message" actions:nil]; 

任何想法,为什么我得到所有这些泄漏?

– 编辑 –

我在一个示例项目中尝试了以下内容:

 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; 

我得到了同样的泄漏。 我真的不知道发生了什么事

这是一个iOS错误。

这也是一个重复的SO问题iOS 8只有内存泄漏与UIAlertController或UIActionSheet 1天前发布。

请参阅Apple Bug Reporter问题21005708 ,ARC下的UIAlertController中的内存泄漏。

泄漏似乎是用iOS 8.2和Xcode 6.2修复的