[ios] IdentityLookupUI 프레임워크를 사용하여 통화 및 메시지의 알림 설정 기능 추가하기

iOS 앱에 통화 및 메시지를 받을 때 통화 및 메시지의 발신자를 식별하기 위해 IdentityLookupUI 프레임워크를 사용할 수 있습니다. 이 프레임워크를 사용하여 사용자가 알림을 받을 때 정해진 조건을 기반으로 알림을 설정할 수 있습니다.

IdentityLookupUI 프레임워크란?

IdentityLookupUI 프레임워크는 iOS 12 이상에서 제공되며, 통화 및 메시지의 발신자를 식별하고 차단하는 기능을 제공합니다. 이를 통해 사용자는 스팸 전화나 메시지를 필터링하고 원치 않는 발신자로부터의 알림을 차단할 수 있습니다.

IdentityLookupUI 프레임워크를 사용한 알림 설정 기능 추가하기

IdentityLookupUI 프레임워크를 사용하여 알림 설정 기능을 추가하는 방법은 다음과 같습니다.

1. CallDirectory App Extension 생성하기

먼저, CallDirectory App Extension을 생성해야 합니다. App Extension은 기본 앱과는 별도로 차단할 전화번호 및 메시지를 설정하기 위한 인터페이스를 제공합니다.

import IdentityLookup

class CallDirectoryHandler: CXCallDirectoryProvider {
    override func beginRequest(with context: CXCallDirectoryExtensionContext) {
        // 전화번호나 메시지 설정 처리
    }
}

2. 사용자 인터페이스 추가하기

IdentityLookupUI 프레임워크를 사용하여 설정 화면에 사용자가 알림을 받을 조건을 설정할 수 있는 인터페이스를 추가합니다.

import IdentityLookupUI

class NotificationSettingsViewController: UIViewController {
    func showNotificationSettingsUI() {
        let extensionContext = ...
        let viewConroller = ILMessageFilterExtensionViewController(extensionContext: extensionContext, for: extensionContext)
        present(viewConroller, animated: true, completion: nil)
    }
}

3. 앱과 Extension 연결하기

알림 설정 기능을 추가한 앱과 CallDirectory App Extension을 연결하여 정상적으로 동작하도록 설정해야 합니다.

<key>NSExtensionAttributes</key>
<dict>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.callkit.call-directory</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.callkit.call-directory</string>

결론

IdentityLookupUI 프레임워크를 사용하여 통화 및 메시지의 알림 설정 기능을 추가하면 사용자가 알림을 받을 때 발신자를 식별하고 필터링하거나 차단할 수 있는 편리한 기능을 제공할 수 있습니다. iOS 앱에 이러한 기능을 추가하여 사용자 경험을 향상시킬 수 있습니다.

더 자세한 내용은 Apple 공식 문서 를 참고하시기 바랍니다.