My app uses a UIImagePickerController to allow the user to choose an image from their camera roll. This was all working fine up to iOS 9.3.4, but the iOS 10 betas now generate this error after the user has selected and tapped an image thumbnail from the picker: "[Generic] Creating an image format with an unknown type is an error". My picker is set to show kuTypeImage mediaTypes, but that's all I can think of doing.
I've added some NSLogs in the code for when the picker is displayed, and for when the user has selected an image in the imagePickerController:didFinishPickingMediaWithInfo: method. However, the error seems to be generated as soon as the image is selected, but before the picker is dismissed, so it appears before the imagePickerController:didFinishPickingMediaWithInfo: method.
Does anyone know how to fix this? As it stands, the image the user selectes is NOT returned to the method, so I can't use it.
I'm using iOS 10 beta 5 and Xcode 8 beta 5.
Here's the code:
- (void)showImageChooser
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
[picker setDelegate:self];
[picker setModalPresentationStyle:UIModalPresentationFullScreen];
[picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[picker setAllowsEditing:NO];
[picker setMediaTypes:[[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil]];
self.imagePickerController = picker;
NSLog(@"Presenting imagePicker");
[self presentViewController:self.imagePickerController animated:YES completion:NULL];
NSLog(@"imagePicker presented");
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"didFinishPickingMediaWithInfo");
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
/ Do stuff with the image...
[picker dismissViewControllerAnimated:YES completion:nil];
}
Thanks.