iOS에서 SMS 알림 처리

improve this page | report issue

개요

SMS 알림은 푸시 알림의 서브세트이므로 먼저 iOS의 푸시 알림 학습서를 완료해야 합니다.

전제조건:

다음으로 이동:

알림 API

SMS 알림에서는 디바이스 등록 시 전화번호 값이 전달됩니다.

인증 확인 핸들러

push.mobileclient 범위가 보안 검사에 맵핑되는 경우에는 푸시 API를 사용하기 전에 일치하는 인증 확인 핸들러가 존재하며 등록되어 있는지 확인해야 합니다.

초기화

클라이언트 애플리케이션이 올바른 애플리케이션 컨텍스트를 사용하여 MFPPush 서비스에 연결하기 위해 필요합니다.

  • 다른 MFPPush API를 사용하기 전에 먼저 API 메소드를 호출해야 합니다.
  • 수신된 푸시 알림을 처리하도록 콜백 함수를 등록합니다.
MFPPush.sharedInstance().initialize()

디바이스 등록

디바이스를 푸시 알림 서비스에 등록합니다.

MFPPush.sharedInstance().registerDevice(jsonOptions){ (response, error) -> Void in
     if error == nil {
         // Successfully registered
     } else {
         // Registration failed with error
     }
 })
  • optionObject: 디바이스를 등록하는 데 사용할 전화번호가 포함된 jsonOptions입니다. 예를 들어, 다음과 같습니다.
let phoneNumber: String = self.phoneNumberTF.text!

let jsonOptions: [AnyHashable: Any] = [
    "phoneNumber": phoneNumber
]

if JSONSerialization.isValidJSONObject(jsonOptions) {
    // JSON is valid and can be sent with registerDevice request
}

푸시 디바이스 등록(POST) REST API를 사용하여 디바이스를 등록할 수도 있습니다.

디바이스 등록 취소

푸시 알림 서비스 인스턴스에서 디바이스를 등록 취소합니다.

MFPPush.sharedInstance().unregisterDevice { (response, error)  -> Void in
    if error == nil {
        // Unregistered successfully
    } else {
        // Failed to unregister
    }
})

SMS 등록 서블릿 사용

REST API는 등록된 디바이스에 알림을 전송하는 데 사용됩니다. 모든 양식의 알림(태그 & 브로드캐스트 알림 및 인증된 알림)을 전송할 수 있습니다.

알림을 전송하기 위해 REST 엔드포인트에 대한 POST를 사용하여 요청이 작성됩니다. imfpush/v1/apps/<application-identifier>/messages.
예제 URL:

https://myserver.com:443/imfpush/v1/apps/com.sample.sms/messages

모든 푸시 알림 REST API를 검토하려면 사용자 문서에서 REST API 런타임 서비스 주제를 참조하십시오.

알림을 전송하려면 알림 전송 학습서를 참조하십시오.

샘플 애플리케이션의 이미지

샘플 애플리케이션

Xcode 프로젝트를 클릭하여 다운로드하십시오.

샘플 사용법

샘플의 README.md 파일에 있는 지시사항을 따르십시오.

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on May 13, 2020