-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ios): Importing corrupt images using the Camera plugin crashes the app (CB-13415) #310
base: master
Are you sure you want to change the base?
Conversation
@jcesarmobile |
@alpesh12 from what I see,
|
All the following errors are because of the failed build. Not sure why paramedic continues the test run after a build failure though... |
src/ios/CDVCamera.m
Outdated
PHImageRequestOptions *option = [PHImageRequestOptions alloc]; | ||
option.synchronous = true; | ||
[manager requestImageDataForAsset:asset options:option resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { | ||
data = imageData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the error that @alsorokin pointed out. Inherently this whole PR has to be re-worked since here on this line, this an async block (a callback) that resides in a synchronous function. For this to work, the processImage function has to be async, and changing that is not trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shazron
Its default functionality from PHFetchResult
lib to return data from block to function, so it must be synchronous operation.
Let me know if you have other reference or solution to solved this bug.
Looks like the CI failures are paramedic related -- iOS tests pass which is good. I'll have to do a full review based on the new commits and test manually. |
I've checked the code and the geolocation part won't work with this changes. Also adds code duplication and commented code. And the code to avoid the crash is only present for the case that there is no image changes (such as quality, resolution, etc). BTW, as on the Android PR, the problem is not the corrupt image itself, but the increase of memory needed to handle it. The corrupt image works correctly with the old code in iPhone X and iPad pro, but crash the app on an iPod touch. I like the idea of using Photos Framework to get the images, but it still requires more changes before it can be merged. |
@jcesarmobile Yes correct its old code working in iPhoneX and iPad pro also its issue of Out of memory exception iPhone5. |
@jcesarmobile @shazron |
Sorry, I have no time to review the changes at this moment, as I told you on a previous PR, I do this in my spare time and I don't have spare time right now |
+1 |
+1 It will be really helpful if we get this piece of code. |
@jcesarmobile |
@jcesarmobile Please check if you got some free time this weekend. I have tested this and working fine for me. |
@shazron +1 For this fix; it solves several issues that we're experiencing with corrupt and/or large images. Requesting a review of this Pull Request for a merge |
@jcesarmobile @shazron @alsorokin |
There's still one test failure, is it expected?
|
I've tried restarting tests and it's still there |
@alsorokin i think its not expected, iOS test already passed |
I see. Well, If you've changed the function signature, I guess you should also change the test to pass that new argument to it. |
How can i do that? |
This is the line that is failing: Hope that helps :) |
But this iOS test already passed. |
I'm not sure what you mean. |
@alsorokin |
@alsorokin |
Well I guess we have to wait until he reviews it then. |
@shazron Can you please check and merge code. |
@jcesarmobile @shazron |
I have a long list of things to review/merge, and every time somebody pings me or comment with +1 on the PR trying to rush it, I move it to the bottom of my list. For people commenting with +1, please, stop doing it. GitHub added the reactions long time ago, if you reaction with +1 on the PR instead of a +1 comment, then we can sort the PRs by the reactions and know which one has more +1, while a comment just spams everybody subscribed and piss off collaborators like me. |
@jcesarmobile |
So, you didn't read my comment or you didn't care and pinged me again trying to rush me, so I just removed it from my list. |
@jcesarmobile |
1 test failure left:
|
@alpesh12 Could you please take a look at the remaining test failure? Shouldn't be too hard to fix, then we can properly review this PR and see if it can be merged. Thanks. |
Platforms affected
What does this PR do?
What testing has been done on this change?
Tested with cordova-ios : 4.5.4
Checklist