콘텐츠로 건너뛰기

Unity용 배지 설정하기

Unity 플러그인에는 PWNotificationExtensionManager 헤더가 포함되어 있지 않으므로, Unity 프로젝트에 배지를 구현하려면 몇 가지 추가 단계를 수행해야 합니다.

1. Notification Service Extension 추가하기 (File -> New -> Target…)

Anchor link to

2. “Notification Service Extension” 선택하기

Anchor link to

3. 다음과 같이 NotificationService 확장 타겟에 Pushwoosh.xcframework를 추가합니다:

Anchor link to
  1. NotificationService 확장 타겟을 선택합니다.
  2. General” 탭으로 이동합니다.
  3. Framework and Libraries’를 찾아 ’+’ 버튼을 누릅니다.
  4. Pushwoosh.xcframework를 선택합니다.

4. 다음과 같이 Notification Service Extension 코드를 업데이트합니다:

Anchor link to
#import "NotificationService.h"
#import "PWNotificationExtensionManager.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
[[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request contentHandler: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.
self.contentHandler(self.bestAttemptContent);
}
@end

5. 애플리케이션의 각 타겟에 “App Groups Capability”를 추가합니다

Anchor link to
App Groups 기능 Info.plist

6. 애플리케이션의 각 타겟에 대한 info.plist에 App Groups ID를 추가합니다

Anchor link to
<key>PW_APP_GROUPS_NAME</key>
<string>group.com.example.demoapp_example</string>

피드백을 공유해주세요

Anchor link to

여러분의 피드백은 더 나은 경험을 만드는 데 도움이 됩니다. SDK 통합 과정에서 문제가 발생하면 저희에게 알려주세요. 어려움을 겪으신다면 주저하지 마시고 이 양식을 통해 의견을 공유해주세요.