iOS 8 Only Memory Leak with UIAlertController or UIActionSheet

后端 未结 4 1215
余生分开走
余生分开走 2020-12-16 20:48

I\'m seeing a memory leak in iOS 8 in simulator when I do the following with UIActionSheet or UIAlertController. UIActionSheet uses UIAlertController in IOS 8 so the issues

4条回答
  •  轮回少年
    2020-12-16 21:32

    I would suggest to use "UIAlertController" in iOS8. And dismiss the alertController object from the presented controller, while firing any event by "UIAlertAction" block.

    UIAlertController  *alertController = [UIAlertController alertControllerWithTitle:@"title"
    message:@"message"
    preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction  *alertAction = [UIAlertAction actionWithTitle:@"actionTitle"
    style:UIAlertActionStyleDefault
    handler:^(UIAlertAction *action) {
    //Do ur stuff
    [alertController dismissViewControllerAnimated:YES
                                        completion:NULL];
    }];
    [alertController addAction:alertAction];
    [self presentViewController:alertController
                           animated:YES
                         completion:NULL];
    

提交回复
热议问题