Xcode 14.1 버전 기반으로 설명하고 있습니다.
iOS용 핑거푸시 SDK를 다운로드 하신 후 Sample 소스를 참고하시기 바랍니다.
Notification Service Extension 생성
1) 기존 앱에 새 타겟(Notification Service Extension)을 추가합니다.
2) 새 타겟의 옵션을 각자에 맞게 설정합니다.
애플 개발자 사이트에서 Notification Service Extension 만의 App ID와 Provisioning Profiles을 생성해줘야 합니다.
Embed In Application 설정은 Xcode의 TAGETS/General/Embedded Binaries에서 수정이 가능합니다.
3) 생성된 NotificationService에서 'fingerNotificationService' 클래스를 적용합니다.
/*Rich Notification*/classNotificationService:fingerNotificationService { override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.disableSyncBadge() super.didReceive(request, withContentHandler: contentHandler) }overridefuncserviceExtensionTimeWillExpire() {// Called just before the extension will be terminated by the system. // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
super .serviceExtensionTimeWillExpire() }}
//NotificationService.h
#import <UserNotifications/UserNotifications.h>
#import "fingerNotificationService.h"
@interface NotificationService : fingerNotificationService
@end
//NotificationService.m
@interface NotificationService ()
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
[self disableSyncBadge];
[super didReceiveNotificationRequest:request withContentHandler:contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
[super serviceExtensionTimeWillExpire];
}
@end
Rich Notification 발송
핑거푸시 사용자 콘솔에서 이미지 혹은 웹링크를 넣어 보내면 Rich Notification 형식으로 푸시를 발송합니다.