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 presentModalViewcontroller:animated
being deprecated in iOS6. I also get dismissModalViewController:animated
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];
}
As Vishal mentioned
make sure you have added "completion:nil" as well
Instead of
and
Instead of
Use this line & check:
Use:
And then for your dismissal modal use:
or