[ios] ContactsUI에서 연락처의 삭제 알림을 받는 방법은 무엇인가요?

아래는 CNContactStoreDidChangeNotification을 사용하여 삭제 알림을 받는 간단한 예제입니다.

먼저, NotificationCenter에 옵저버를 추가하여 CNContactStoreDidChangeNotification을 처리합니다.

import Contacts
import ContactsUI

NotificationCenter.default.addObserver(self, selector: #selector(contactStoreDidChange(_:)), name: .CNContactStoreDidChange, object: nil)

그런 다음, contactStoreDidChange(_:) 메서드를 구현하여 삭제 알림을 처리합니다.

@objc func contactStoreDidChange(_ notification: Notification) {
    // 삭제된 연락처를 처리하는 로직을 여기에 추가합니다.
}

이제 CNContactStoreDidChangeNotification을 사용하여 ContactsUI에서 연락처의 삭제 알림을 받을 수 있습니다.