Swift 3 - UIImageWriteToSavedPhotosAlbum 内存问题

标签 swift memory uiimagepickercontroller

我在 UIImagePickerController 类中使用 UIImageWriteToSavedPhotosAlbum 方法来保存使用我的应用程序拍摄的照片。它工作正常,但问题是每张保存的照片需要 30mb+ 的 RAM,并且内存永远不会释放,显然如果我保存多张照片,会因内存问题而导致崩溃。 有人可以帮我解决这个问题吗?

最佳答案

将调用包装在自动释放池中

自动释放池{ //在这里进行一次保存 }

<小时/>

如果此后内存没有下降 100%,请检查是否有保留内存的东西

关于Swift 3 - UIImageWriteToSavedPhotosAlbum 内存问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45283190/

相关文章:

iOS 5 GM : <Error>: More than maximum 5 filtered album lists trying to register. 这将失败

iPhone UIImagePickerController : show camera preview on top of openGl viewport

ios - 如何从 UIImagePickerController 导入图像到新的 VC? swift

swift - iOS 11 simd 矩阵线性组合去哪儿了?

swift - 自动布局 ImageView 高度 anchor 在 Collection View 中发生冲突并且无法正常工作

c - "invalid next size"重新分配内存时出现异常

memory - 只有 'Import keras' 在 GPU 中占用 10GB

swift - NSPredicate 与 Swift 和核心数据

快速评级系统循环和分配

C++ 内存顺序一致性