Ram Ram - 8 months ago 134
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];


Use this line & check:

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