Vazamentos com o UIAlertController
Eu adicioneiUIAlertController
no meu aplicativo, criando uma categoria emUIViewController
com o seguinte método:
- (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];
}
No começo, tudo parece ótimo, mas quando analiso vazamentos com Instruments, cada vez que chamo esse método, alguns vazamentos aparecem:
Aqui está como a chamada deshowAlertViewWithTitle:message:actions:
é feito
[self showAlertViewWithTitle:nil message:@"Test message" actions:nil];
Alguma idéia de por que recebo todos esses vazamentos?
- EDITAR -
Eu tentei o seguinte em um projeto de exemplo:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"message"
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
e eu tenho os mesmos vazamentos. Eu realmente não tenho certeza do que está acontecendo ...