포그라운드 알림 전달 | Push | Appbox iOS SDK 가이드
포그라운드 알림 전달
포그라운드 알림 전달
AppBox.handleForegroundNotification(_ request: UNNotificationRequest) -> Bool
Swift
1
func userNotificationCenter(
2
_ center: UNUserNotificationCenter,
3
willPresent notification: UNNotification,
4
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
5
) {
6
_ = AppBox.handleForegroundNotification(notification.request)
7
completionHandler([.badge, .alert, .sound])
8
}
1
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
2
willPresentNotification:(UNNotification *)notification
3
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
4
[AppBox handleForegroundNotification:notification.request];
5
completionHandler(
6
UNNotificationPresentationOptionBadge |
7
UNNotificationPresentationOptionAlert |
8
UNNotificationPresentationOptionSound
9
);
10
}
Request 항목 정의
| Request 항목 | 필수여부 | 설명 | 기본값 |
|---|---|---|---|
request | 필수 | willPresent callback이 전달한 UNNotificationRequest | - |
Response 항목 정의
| Response 결과값 | |
|---|---|
Bool | 알림 요청을 Push runtime에 전달했는지 여부. 즉시 반환됩니다 |
UNUserNotificationCenterDelegate를 앱에서 지정해야 합니다. 알림 표시 옵션은 SDK가 아니라 앱의 completionHandler에서 결정합니다. 시스템 completion handler를 반드시 호출합니다.
AppDelegate 연결 예제는 AppBoxSampleiOS에서 확인할 수 있습니다.