My application use UIImagePickerController for taking photos. It works well but one serious problem — memory crashes. The application crashes always after taking several photos, mostly around 4-6. Looked through the debug information, I found it occurs memory warning message frequently and crashes after entering didReceivedMemoryWaning twice. Viewing the memory use in Instrument (which is the performance tool integrated in xcode) , the memory in use increase about 18 MB, it’s really horrible. After a long time research, I got some solutions to improve it.
1. hold an UIImagePickerController instance during the lifetime of the application, this will avoid lots of memory leaks
2. set allowImageEditing property of UIImagePickerController to NO, if it’s not so necessary
Cocoa China也是非常好的网站,论坛高手如云,给过我很多帮助,特此感谢
相关文章