TimOliver / TOCropViewController

A view controller for iOS that allows users to crop portions of UIImage objects
http://www.timoliver.com.au/2015/06/21/tocropviewcontroller-an-open-source-image-cropper-for-ios/
MIT License
4.7k stars 938 forks source link

crashed in iPhone 6 #11

Closed ArjunSa786 closed 8 years ago

ArjunSa786 commented 9 years ago

hi tim i have implemented your code .it was superrr.i have faced this issue in iphone 6 . Received memory warning. Communications error: <OS_xpc_error: <error: 0x19b382a80> { count = 1, contents = "XPCErrorDescription" => <string: 0x19b382e78> { length = 22, contents = "Connection interrupted" } }> Connection to assetsd was interrupted or assetsd died Terminating since there is no system app.

TimOliver commented 9 years ago

Hi Arjun! Glad you're enjoying the app!

Oh dear! I remember seeing that once or twice during development in the simulator, but never on the device. I did a bit of research just now and it looked like it's an issue that arrises if a memory warning occurs.

How big is the image you were trying to crop?

ArjunSa786 commented 9 years ago

hi tim thanks for reply images size is 1.9 MB

TimOliver commented 9 years ago

Hrmm, and what was its pixel resolution? When you're manipulating it in the crop controller, it gets decompressed into raw pixel data, which can take up a lot more memory than what's on disk.

I might have to look into making the controller a bit more memory efficient. Or if worse comes to worse, you can always downscale your images before sending them to the crop controller.

ArjunSa786 commented 9 years ago

750X1334 resolution.i was pick image in image picker controller and pass to image in cropview.when i click done button it will happen .

TimOliver commented 9 years ago

Aw. That's absolutely tiny. That shouldn't be causing any memory issues. :S

I'm not sure then. Is it happening reliably each time you use the cropper? And, just in case, are you doing any rotations to the image?

-Tim

On 5 August 2015 at 13:20, ArjunSa786 notifications@github.com wrote:

750X1334 resolution.i was pick image in image picher controller and pass to image in cropview.

— Reply to this email directly or view it on GitHub https://github.com/TimOliver/TOCropViewController/issues/11#issuecomment-127859974 .

ArjunSa786 commented 9 years ago

No, i am not doing any rotation,it will come 4 times each of 10 using crop. and when i click done button also show in log -----<<<>>>> <UIVisualEffectView 0x15f66cf10> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1.

TimOliver commented 9 years ago

Hrmm... there's literally none of my code in that call stack. I wonder what's going on. :S

ArjunSa786 commented 9 years ago

iMAGE RESOLUTION (3264.0, 2448.0) orientation 0 scale 2.000000 and returncropped image resolution is {6528, 4892} when convert into byte 1203580 bytes using let imageData = UIImageJPEGRepresentation(image, 0.0) any idea reduse size but not dimension ?

ArjunSa786 commented 9 years ago

[self.image croppedImageWithFrame:cropFrame angle:angle] when call this method dimention is double. how to change?

iori57 commented 9 years ago

My app is crashing as well when trying to crop a very large image. The image is 3.3MB in size and with resolution 3264x2448 which is a photo taken using iPhone 6 plus. If I don't reduce the crop area but use the full size and press the Done button, half of the time it will crash the app with error 'Received memory warning.' Sometimes I can even see the white apple logo after the crash but the device is not restarting, it just go back to home screen :)

I have uploaded a sample image that i used here: https://dl.dropboxusercontent.com/u/9307455/largeimage.zip

ArjunSa786 commented 9 years ago

hi lori57

please change UIImage+CropRotate.m file

hope it help

TimOliver commented 8 years ago

Oh! That actually did it! I didn't think to look there; I was looking at my actual layout code to try and figure out what was going on. I can't believe I completely missed that.

Anyway, I've updated it in the repo now (I elected to use the image.scale property instead of 1.0f just in case). Please give it a try and tell me if it's working for you now (And I'll reopen this issue).

Thanks again!