Pulkit Goyal
Pulkit Goyal

Reputation: 5654

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. I store every image as a ALAsset * in an array. 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?

Upvotes: 0

Views: 1201

Answers (1)

Joe Smith
Joe Smith

Reputation: 1920

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.

Upvotes: 2

Related Questions