iOS 8 Nur Speicherverlust mit UIAlertController oder UIActionSheet
Beim Ausführen der folgenden Aktionen mit UIActionSheet oder UIAlertController tritt in iOS 8 im Simulator ein Speicherverlust auf. UIActionSheet verwendet UIAlertController in IOS 8, sodass die Probleme zusammenhängen.
showCameraAction wird aufgerufen, wenn eine Taste gedrückt wird. Ich habe den gesamten Inhalt aus der Delegate-Methode entfernt und erhalte dennoch das Leck in dem unten gezeigten Fall. Benutze ich UIActionSheet auf eine Art und Weise, die ich nicht sollte? Ich würde mich über jede Hilfe bei der Lösung dieses Problems freuen. Derselbe Code weist unter IOS 7 (im Simulator) keine Lecks auf.
-(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
}
//leere
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
}
Auch versucht mit UIAlertController, mit dem gleichen Ergebnis:
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 mit Ablaufverfolgung:https: //www.dropbox.com/l/FmnTCd0PvVhuu16BVHZo7