开发者

Preventing crash after imagePickerController:didFinishPickingMediaWithInfo

开发者 https://www.devze.com 2023-02-28 18:33 出处:网络
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.

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];

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号