UIImagePickerController image editing not working
- by Greg Reichow
I am having a problem with implementing UIImagePickerController. When the controller loads, it displays modally, and allows the user to select the image. Good so far. Yet, then when it moves to the editing phase, it often displays somewhat corrupted view (the image cropping box is halfway off the top of the screen) and their is no image. It does not crash, but all UI interaction is blocked. The strange part is that this only happens when I compile with Release settings. Under debug compile settings, the image editing works fine! I have tried checking for memory warnings during this time, but none are showing up. Here is the code calling the image picker controller for reference. When I use the camera (the first method), it always works fine. It is just when selecting images from the Library (called from the second method below) does it fail as described above. And again, only on release build, and with various different types of images.
- (IBAction) showCameraController:(id)sender
{
self.imagePicker =[[UIImagePickerController alloc] init];
self.imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
self.imagePicker.delegate=self;
self.imagePicker.allowsEditing=YES;
[self presentModalViewController:self.imagePicker animated:YES];
}
- (IBAction) showPictureAlbumController:(id)sender
{
self.imagePicker =[[UIImagePickerController alloc] init];
self.imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePicker.delegate=self;
self.imagePicker.allowsEditing=YES;
[self presentModalViewController:self.imagePicker animated:YES];
}
The delegate methods are properly implemented, yet, during the problem I am describing, the controller is not yet calling those methods. It is failing when displaying the editing screen before the user is able to select cancel or save. It is just locking up with no crash. Please help!