Push Notification
Enable / Disable Push Notification
사용자가 Push Notification을 받을 지 여부를 설정할 수 있습니다.
// 사용자 Push Notification 활성화
[[TalkPlus sharedInstance] enablePushNotification:^(TPUser *tpUser) {
// SUCCESS
} failure:^(int errorCode, NSError *error) {
// FAILURE
}];
// 사용자 Push Notification 비활성화
[[TalkPlus sharedInstance] disablePushNotification:^(TPUser *tpUser) {
// SUCCESS
} failure:^(int errorCode, NSError *error) {
// FAILURE
}];// 사용자 Push Notification 활성화
TalkPlus.sharedInstance().enablePushNotification { tpUser in
// SUCCESS
} failure: { (errorCode, error) in }
// FAILURE
}
// 사용자 Push Notification 비활성화
TalkPlus.sharedInstance().disablePushNotification { tpUser in
// SUCCESS
} failure: { (errorCode, error) in }
// FAILURE
}특정 채널의 Push Notification을 받을 지 여부를 설정할 수 있습니다.
// 채널 Push Notification 활성화
[[TalkPlus sharedInstance] enableChannelPushNotification:channel
success:^(TPChannel *tpChannel) {
// SUCCESS
} failure:^(int errorCode, NSError *error) {
// FAILURE
}];
// 채널 Push Notification 비활성화
[[TalkPlus sharedInstance] disableChannelPushNotification:channel
success:^(TPChannel *tpChannel) {
// SUCCESS
} failure:^(int errorCode, NSError *error) {
// FAILURE
}];// 채널 Push Notification 활성화
TalkPlus.sharedInstance().enableChannelPushNotification(channel) { channel in
// SUCCESS
} failure: { (errorCode, error) in
// FAILURE
}
// 채널 Push Notification 비활성화
TalkPlus.sharedInstance().disableChannelPushNotification(channel) { channel in
// SUCCESS
} failure: { (errorCode, error) in
// FAILURE
}Push Notification
Klat의 Push Notification은 FCM을 통하여 이루어지게 됩니다. 기본적인 FCM을 연동하신 후, User를 로그인한 후 registerFCMToken 함수를 호출하여 FCM 토큰을 User 세션에 연동하여야 합니다.
로그인이 완료된 후 아래와 같이 FIRMessaging을 통하여 token을 얻어 register 하시는 것을 권장 드립니다.
그 후 Push Notification이 도착할 경우 아래와 같이 Klat에서 handleFCMMessage 함수를 통하여 payload를 처리하여 기존 등록된 delegate로 이벤트를 전달 드립니다.
Last updated