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];
}
Use this line & check:
[self presentViewController:imagePicker animated:YES completion:nil];
[[Picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
Instead of
[[Picker parentViewControl] dismissModalViewControllerAnimated:YES];
and
[self presentViewController:picker animated:YES completion:nil];
Instead of
[self presentModalViewController:picker animated:YES];
As Vishal mentioned
[self presentViewController:imagePicker animated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
make sure you have added "completion:nil" as well
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
[self presentViewController:objSignupViewController animated:^{} completion:nil];
}
else
{
[self presentModalViewController:objSignupViewController animated:YES];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With