App Crashes after taking some Pictures

Hi, I have an app that allows user to report damages of their cars.
In some cases users have to take more then 40-50 pictures.
After a while (I guess 30 pictures and above) Xcode logs the following:
[MC] Invalidating cache
[MC] Reading from public effective user settings.

Some pictures later the app crashes while taking a picture and logs:
[ProcessSuspension] 0x28137aa40 - ProcessAssertion() Unable to acquire assertion for process with PID 10149

seems like a memory issue, what can I do to solve this ?

are you keeping track of these pictures in memory? if yes, I would advice to use the cordova plugin file (https://beta.ionicframework.com/docs/native/file) and to save them in a temp directory respectively to only keep the actual one (or these which really matters) in memory

Current behavior is that the user takes a couple of images and I temporarily save them in a service as base64. If the user finishes the process all informations and images get uploaded.
Rarely some user take more then 40 pictures. So I guess I have to save each image as a file and only save the file path in my service to upload all together when the user has finished ? Am I right ?

exactly what I did implement. I can’t guaranty that your problem is a memory problem regarding the too much pictures in memory but that sounds like it right? so yep I would go that way

so basically

  • user take picture -> use the camera with file url -> save the url in your service
  • if you display the pictures in your app before upload, use this url to display them (use webView.convertFileSrc() and sanitize)
  • when you upload your files, read the file url from your service, get the content as base64 or blob and upload

Okay, thanks for clarify it to me. I will try it as soon as possible.

1 Like