My application keeps a cache of ALAssets. The user may put the app into the background and then use the Photos app, or some other means, to delete some photos or videos. When my app is in the background, I do not get the notification from ALAssetsLibrary that data has changed. Does anyone have an optimal approach to syncing my application state with the ALAssetsLibrary state when the application becomes active again?
Upate: It looks like I can use this approach to iterate back over the entire library, but it seems an inefficient way to get the delta of changes.
How to check if an ALAsset still exists using a URL
You should register for ALAssetsLibraryChangedNotification and only reenumerate the Library, when you receive the notification, that the Library has actually changed. You will receive this notification, when you app is in the foreground again. Please note that, there is a bug in iOS 5.X regarding ALAssetsLibraryChangedNotification: http://www.openradar.me/10484334
Cheers,
Hendrik
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With