Leaks with UIAlertController

I added UIAlertController in my app by creating a category on UIViewController with the following method:

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

At first, everything looks great but when I analyze leaks with Instruments, each time I call this method, some leaks appear:

  • Loop over multiple UIAlertController's
  • UIAlertController button function not working
  • UIAlertController is moved to buggy position at top of screen when it calls `presentViewController:`
  • How to rotate UIAlertController in Swift
  • show UIAlertController outside of ViewController
  • How to create Custom UIAlertController in swift ios?
  • enter image description here

    Here is how the call of showAlertViewWithTitle:message:actions: is done

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

    Any idea why I get all these leaks?

    — EDIT —

    I tried the following in a sample project:

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

    and I get the same leaks. I’m really not sure what’s going on…

    2 Solutions Collect From Internet About “Leaks with UIAlertController”

    This is an iOS bug.

    This is also a duplicate of SO question iOS 8 Only Memory Leak with UIAlertController or UIActionSheet posted 1 day earlier.

    See Apple Bug Reporter issue 21005708, Memory leak in UIAlertController under ARC.

    The leak seems to be fixed with iOS 8.2 and Xcode 6.2