В данный момент CNContactStoreDidChangeNotification не дает изменений.Так что, если у вас есть некоторые кэшированные контакты, вы должны повторно получить их, когда приходит уведомление.
-(void)registerForCNContactStoreDidChangeNotification {
if (!self.hasRegisteredForNotifications) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(storeDidChange:) name:CNContactStoreDidChangeNotification object:nil];
self.hasRegisteredForNotifications = YES;
}
}
- (void)deviceContactsDidChange:(NSNotification *)notification {
// notification.userInfo can be nil
// need to fetch all contacts with enumerateContactsWithFetchRequest to get all contacts or
// refresh the cached contacts with unifiedContactsMatchingPredicate
}
Apple говорит:
Если вы кэшируете выбранные контакты, группы или контейнеры, вам необходимо повторно получить эти объекты (и освободить старые кэшированные объекты), когда публикуется CNContactStoreDidChangeNotification.