I am trying to get notification in my application whenever there is any change on contacts list of my iphone device. Here is code i wrote for registering notifier:
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("contactChanged:"), name: CNContactStoreDidChangeNotification, object: nil)
func contactChanged(notification : NSNotification){
print("contact changed notification received")
var userInfo: NSDictionary!
userInfo = notification.userInfo
print(userInfo.allKeys.debugDescription)
}
My method "contactChanged" is called twice or thrice when app comes back from background and if address book was changed. Also there is no information of what was changes in address book. Can you please suggest how to make notifier called once only? and get to know the change? Thanks