简体   繁体   English

将图像保存到已保存的照片后,相机胶卷资产图像不可用

[英]Camera Roll asset images not available after saving an image to Saved Photos

I am using ALAssetsLibrary to make an array of all images in the camera roll when my iPhone app starts. 当我的iPhone应用程序启动时,我正在使用ALAssetsLibrary来生成相机胶卷中所有图像的数组。 I store every image as a ALAsset * in an array. 我将每个图像存储为数组中的ALAsset * Later in the app, I am saving an image to the gallery using this: 稍后在应用程序中,我使用以下方法将图像保存到库中:

UIImageWriteToSavedPhotosAlbum(croppedImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

The image is saved successfully to the saved photos album. 图像已成功保存到已保存的相册中。 But, now my problem is that when I try to retrieve images using the existing array of all images, I don't get anything. 但是,现在我的问题是当我尝试使用所有图像的现有数组检索图像时,我什么都得不到。 Do I need to build the array of all images again or is there some other way to do this? 我是否需要再次构建所有图像的数组,还是有其他方法可以做到这一点?

Saving an image changes the library and invalidates objects like assets from the library. 保存图像会更改库并使库中的资源等对象无效。 You need to reload assets from the library whenever the library changes - do that when you receive an ALAssetsLibraryChangedNotification . 每当库更改时,您都需要从库中重新加载资源 - 在收到ALAssetsLibraryChangedNotification时执行此ALAssetsLibraryChangedNotification

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM