Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIAlertController发生泄漏_Ios_Objective C_Uialertcontroller - Fatal编程技术网

Ios UIAlertController发生泄漏

Ios UIAlertController发生泄漏,ios,objective-c,uialertcontroller,Ios,Objective C,Uialertcontroller,我通过使用以下方法在UIViewController上创建一个类别,在我的应用程序中添加了UIAlertController: - (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)alertActions { UIAlertController *alertCo

我通过使用以下方法在
UIViewController
上创建一个类别,在我的应用程序中添加了
UIAlertController

- (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 8.2和Xcode 6.2修复的这是一个iOS错误

这也是一天前发布的SO问题的副本


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

我在使用xcode 6时未发现任何泄漏。xcode 6.0.1如何?我使用的是6.0.1,您是如何发现泄漏的?我没有在仪器中看到泄漏面板我看到泄漏,有时会发生。@CarouselMin-我指的是仪器中的此泄漏选项:不会在实际设备上泄漏。