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 are related.
showCameraAction gets called when a button is pressed. I've removed all of the content from the delegate method and still get the leak in the case shown below. Am I using UIActionSheet in some way that I shouldn't? I would appreciate any help in resolving this issue. The same code has no leaks with IOS 7 (in the simulator).
-(IBAction)showCameraAction:(id)sender
{
UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"Photo From:"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Phone", @"Flickr", nil];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
//also tried just showInView: self.view
}
//empty
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
}
Also tried with UIAlertController, with the same result:
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"Photo From:"
message:@""
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *phoneAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Phone", @"Phone action")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
NSLog(@"Phone action");
}];
UIAlertAction *flickrAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Flickr", @"Flickr action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"Flickr action");
}];
[alertController addAction:phoneAction];
[alertController addAction:flickrAction];
[self presentViewController:alertController animated:YES completion:nil];
Screenshot with trace: https://www.dropbox.com/l/FmnTCd0PvVhuu16BVHZo7p