presentModalViewController: Animated jest przestarzały w ios6

Używam poniższego kodu do wyboru obrazu. Ale kiedy uruchamiam go w symulatorze, mam wyciek pamięci i dostaję ostrzeżenie o tym, że presentModalViewcontroller:animated jest przestarzały w iOS6. Ja też dostaję dismissModalViewController:animated deprecated. Używam SDK 6.1.

Kod dla ImagePicker:

- (void)showAlbum:(id)sender { 
    imagePicker=[[UIImagePickerController alloc]init];
    imagePicker.delegate = self;
    imagePicker.allowsEditing =NO;
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagePicker animated:YES];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    //release picker
    [picker dismissModalViewControllerAnimated:YES];
}
Author: Super Chafouin, 2013-04-08

5 answers

Użyj tej linii & sprawdź:

[self presentViewController:imagePicker animated:YES completion:nil];
 209
Author: Vishal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-08 08:03:00
[[Picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];

Zamiast

 [[Picker parentViewControl] dismissModalViewControllerAnimated:YES];

I

[self presentViewController:picker animated:YES completion:nil];

Zamiast

[self presentModalViewController:picker animated:YES];
 16
Author: deepesh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-08 08:06:56

Jak wspomniał Vishal

[self presentViewController:imagePicker animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];

Upewnij się, że dodałeś również "zakończenie:nil"

 3
Author: Krishna Sapkota,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-01-19 09:18:58
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
    [self presentViewController:objSignupViewController animated:^{} completion:nil];
}
else
{
    [self presentModalViewController:objSignupViewController animated:YES];
}
 3
Author: Mohit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-08 07:26:12

Użycie:

[self presentViewController:imagePicker animated:YES completion:nil];

A potem do zwolnienia:

[self dismissViewControllerAnimated:controller completion:nil];

Lub

[self dismissViewControllerAnimated:YES completion:nil];
 1
Author: BrainyMonkey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-03-12 22:26:10