Ram Ram - 1 year ago 306
Objective-C Question

presentModalViewController:Animated is deprecated in ios6

I am using the following code for an image picker. But when I run it in the simulator, I have a memory leak and I get a warning about

being deprecated in iOS6. I also get
deprecated. I'm using the SDK 6.1.

Code for 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];

Answer Source

Use this line & check:

[self presentViewController:imagePicker animated:YES completion:nil];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download