iOS 如何使用 Contacts Framework 获取更改的联系人
How to get changed contacts using Contacts Framework in iOS
我可以使用以下方式监控联系人变化:
NotificationCenter.default.addObserver(
self, selector: #selector(contactStoreDidChange), name: .CNContactStoreDidChange, object: nil)
}
@objc func contactStoreDidChange(notification: NSNotification) {
}
但是如何从通知中获取更改的联系人?例如哪个联系人是 added/removed/changed 等?
您只能在 method.and 中收到通知,您必须重新获取所有对象并为更新的数据再次创建数据源!
我可以使用以下方式监控联系人变化:
NotificationCenter.default.addObserver(
self, selector: #selector(contactStoreDidChange), name: .CNContactStoreDidChange, object: nil)
}
@objc func contactStoreDidChange(notification: NSNotification) {
}
但是如何从通知中获取更改的联系人?例如哪个联系人是 added/removed/changed 等?
您只能在 method.and 中收到通知,您必须重新获取所有对象并为更新的数据再次创建数据源!