开发者

UIImagePickerController unloads underlying ViewControllers with memory warning

开发者 https://www.devze.com 2023-01-28 07:37 出处:网络
In my iPhone application, I\'ve noticed that when using the UIImagePickerController it typically causes memory warnings to happen. I\'ve read that this isn\'t uncommon and I know that my memory footpr

In my iPhone application, I've noticed that when using the UIImagePickerController it typically causes memory warnings to happen. I've read that this isn't uncommon and I know that my memory footprint is pretty small otherwise.

My problem is that when UIImagePickerController is up and it throws a memory warning, it unloads the view that presented it. After a user selects a video or image, their previously entered data is gone since the view was reloaded.

Is there any way to prevent the view from unloading, or is there a better solution? I've seen simil开发者_Python百科ar questions, but no good solutions.

Thanks for your answers.


Preventing the view from unloading is probably not a good idea, since you're playing a game of chicken with the reaper (i.e. the OS could kill your app for misbehaving).

If you're concerned about losing state information, you could write that data to disk in a temporary file in your application's temp directory, and set a flag in the view/controller that says "reload me from disk".

0

精彩评论

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