ALAssetsLibrary doesn't send ALAssetsLibraryChangedNotification
| Originator: | nskboy | ||
| Number: | rdar://10484334 | Date Originated: | 24-Nov-2011 01:52 AM |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 5.0/9a405 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
It's impossible to detect changes in ALAssetsLibrary while running on iOS 5.0-5.0.1 because no one sends ALAssetsLibraryChangedNotification
Steps to Reproduce:
1. Run the attached sample on device with iOS 5.0.1
2. Open Xcode debug console
3. Hit power + home buttons to capture screenshot
Expected Results:
Debug output indicating printing description of ALAssetsLibraryChangedNotification
Actual Results:
No debug output
Regression:
According to https://devforums.apple.com/message/549591 this bug appeared in iOS 5 beta 6
Notes:
There are two workarounds for this issue:
1. Call [self.assetsLibrary writeImageToSavedPhotosAlbum:nil metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { }]; immediately after creating instance of ALAssetsLibrary
2. Observe NSManagedObjectContextObjectsDidChangeNotification
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
This workaround has a side effect that it requests permission to access Photos on iOS 6 (maybe popping up a dialog asking the user), which you may not want to do at this point.