If you don't have a reference to the group being deleted, the OS doesn't let you know.
I get the correct behavior using the following code:
#import "ROBKViewController.h"
#import <AssetsLibrary/AssetsLibrary.h>
@interface ROBKViewController ()
@property (nonatomic, strong) ALAssetsLibrary *assetsLibrary;
@property (nonatomic, strong) ALAssetsGroup *currentAssetGroup;
- (void) handleAssetChangedNotifiation:(NSNotification *)notification;
@end
@implementation ROBKViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
_assetsLibrary = [ALAssetsLibrary new];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAssetChangedNotifiation:) name:ALAssetsLibraryChangedNotification object:_assetsLibrary];
}
return self;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:ALAssetsLibraryChangedNotification object:nil];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
} failureBlock:^(NSError *error) {
}];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Notification handlers
- (void) handleAssetChangedNotifiation:(NSNotification *)notification
{
NSLog(@"notification: %@", notification);
if ([notification userInfo]) {
NSSet *insertedGroupURLs = [[notification userInfo] objectForKey:ALAssetLibraryInsertedAssetGroupsKey];
NSURL *assetURL = [insertedGroupURLs anyObject];
if (assetURL) {
[self.assetsLibrary groupForURL:assetURL resultBlock:^(ALAssetsGroup *group) {
self.currentAssetGroup = group;
} failureBlock:^(NSError *error) {
}];
}
}
}
@end
Note that I only get the notification for the group that assigned to self.currentAssetGroup.