I am working on an image filter effects app.
A current issue with the app is that it crashes when a user picks a very large image from his photo album.
When
imagePickerController:didFinishPickingMediaWithInfo
returns the selected image, I need to present a preview of the selected image in a UIImageView.
I resize the selected image if it's large before presenting it.
For very large images (2开发者_如何学JAVA0 megapixels +) this causes the app to crash - I am not getting any memory warnings before the crash that I can act on.
I would like to prevent a crash, or at least warn the user that this might happen if they select a very large image.
Does anyone have a good idea how to implement this (crash prevention or warning) gracefully?
update
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[[myPicker parentViewController] dismissModalViewControllerAnimated:YES];
NSLog(@"type ur message");
[NSThread detachNewThreadSelector:@selector(useImage:) toTarget:self withObject:image];
}
精彩评论