iOS SDK 7.0+ 고급 통합 가이드
이 섹션에서는 Pushwoosh iOS SDK의 고급 통합에 대한 정보를 제공합니다.
백그라운드 모드
Anchor link to이 기능을 활성화하려면 프로젝트에 백그라운드 모드를 추가해야 합니다.
백그라운드 모드를 활성화하는 단계
Anchor link to- Xcode에서 프로젝트를 열고 Project Navigator에서 선택합니다.
- 왼쪽 패널에서 앱 타겟을 선택합니다.
- Signing & Capabilities 탭으로 이동합니다.
- 왼쪽 상단의 + Capability 버튼을 클릭합니다.
- 목록에서 Background Modes를 검색하여 선택합니다.
- Background Modes 섹션에서 확인란을 선택하여 Remote notifications를 활성화합니다.
완료되면 앱이 백그라운드에서 실행되는 동안 자동 푸시 알림을 포함한 푸시 알림을 처리할 수 있게 됩니다.
포그라운드 모드
Anchor link to기본적으로 Pushwoosh iOS SDK는 앱이 포그라운드에서 실행 중일 때 알림 배너를 표시합니다.
코드(예: AppDelegate에서)에 다음 불리언 플래그를 설정하여 이 동작을 제어할 수 있습니다.
// 포그라운드 알림을 비활성화하려면 false로, 활성화하려면 true로 설정합니다Pushwoosh.configure.showPushnotificationAlert = true// 포그라운드 알림을 비활성화하려면 0으로, 활성화하려면 1로 설정합니다[[Pushwoosh configure] setShowPushnotificationAlert:0];로그 레벨
Anchor link toPushwoosh iOS SDK는 다음 로깅 레벨을 지원합니다:
NONE- SDK에서 로그 없음.ERROR- 콘솔에 오류 메시지만 표시합니다.WARNING- 오류 외에 경고도 표시합니다.INFO- 정보 메시지를 포함합니다 (기본 설정).DEBUG- 상세한 디버그 정보를 포함합니다.
기본적으로 로깅 레벨은 INFO로 설정되어 있어 SDK가 개발자 콘솔을 복잡하게 만들지 않으면서 관련 정보를 제공하도록 보장합니다.
로깅 레벨을 수정하려면 앱의 Info.plist 파일에서 Pushwoosh_LOG_LEVEL 키를 업데이트하세요:
<key>Pushwoosh_LOG_LEVEL</key><string>YOUR_LOG_LEVEL</string>또는 아래 코드 스니펫을 사용하여 로그 레벨을 변경할 수 있습니다:
Pushwoosh.Debug.setLogLevel(.PW_LL_DEBUG)YOUR_LOG_LEVEL을 원하는 레벨(예: DEBUG 또는 ERROR)로 바꾸세요.
사용자 지정 UNNotificationCenterDelegate
Anchor link to자신만의 UNNotificationCenterDelegate를 사용하려는 경우(예: 로컬 알림용), 올바른 동작을 위해 Pushwoosh SDK에 알려야 합니다. addNotificationCenterDelegate 메서드를 사용하여 이를 수행할 수 있습니다:
Pushwoosh.configure.addNotificationCenterDelegate(my_delegate)[Pushwoosh.configure addNotificationCenterDelegate:my_delegate];그런 다음, 델리게이트에서 UNNotificationCenterDelegate 메서드를 구현합니다:
func userNotificationCenter( _ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if (!PWMessage.isPushwooshMessage(notification.request.content.userInfo)) { // 알림 처리 completionHandler(UNNotificationPresentationOptions.alert) }}
func userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { if (!PWMessage.isPushwooshMessage(response.notification.request.content.userInfo)) { // 알림 처리 completionHandler() }}- (void)userNotificationCenter:(UNNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { if (![PWMessage isPushwooshMessage:notification.request.content.userInfo]) { // 메시지 처리 completionHandler(UNNotificationPresentationOptionAlert); }}
- (void)userNotificationCenter:(UNNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { if (![PWMessage.isPushwooshMessage:response.notification.request.content.userInfo]) { // 메시지 처리 completionHandler(); }}Pushwoosh 지연 초기화
Anchor link toPushwoosh_LAZY_INITIALIZATION 플래그는 애플리케이션 시작 시 Pushwoosh SDK의 자동 초기화를 방지합니다. 이를 통해 Pushwoosh SDK 서비스가 시작되는 시점을 더 잘 제어할 수 있습니다.
이 플래그가 활성화되면 Pushwoosh SDK는 Pushwoosh iOS SDK 메서드가 명시적으로 호출될 때까지 서비스를 시작하지 않습니다.
Info.plist에 다음 항목을 추가합니다:
<key>Pushwoosh_LAZY_INITIALIZATION</key><true/>사용 사례
-
제어된 SDK 초기화 –
Pushwoosh_LAZY_INITIALIZATION플래그를 사용하면 Pushwoosh SDK 시작을 지연시켜 푸시 서비스가 활성화되는 시점을 더 잘 제어할 수 있습니다. -
지연된 푸시 활성화 – 일부 애플리케이션에서는 특정 조건 하에서만 푸시 알림을 초기화해야 합니다. 이 플래그를 활성화하면 Pushwoosh SDK가 명시적으로 요청될 때만 시작되도록 보장합니다.
-
사용자별 푸시 구성 – 일부 애플리케이션은 사용자 기본 설정이나 계정 설정에 따라 푸시 알림 설정을 사용자 지정해야 할 수 있습니다. 지연 초기화를 사용하면 적절한 구성이 결정된 후에만 Pushwoosh SDK가 시작됩니다.
Info.plist 속성 전체 목록
Anchor link to| 속성 | 설명 | 가능한 값 |
|---|---|---|
Pushwoosh_APPID | 프로덕션 빌드용 Pushwoosh 애플리케이션 ID를 설정합니다. | XXXXX-XXXXX Type: String |
Pushwoosh_APPID_Dev | 개발 빌드용 Pushwoosh 애플리케이션 ID를 설정합니다. | XXXXX-XXXXX Type: String |
Pushwoosh_SHOW_ALERT | 알림 포그라운드 알림을 표시합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALERT_TYPE | 알림 스타일을 설정합니다. | BANNER (default) / ALERT / NONE Type: String |
Pushwoosh_BASEURL | Pushwoosh 서버 기본 URL을 재정의합니다. | https://cp.pushwoosh.com/json/1.3/ (default) Type: String |
Pushwoosh_AUTO_ACCEPT_DEEP_LINK_FOR_SILENT_PUSH | YES인 경우, 자동 푸시로 수신된 딥 링크가 자동으로 처리됩니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALLOW_SERVER_COMMUNICATION | SDK가 Pushwoosh 서버로 네트워크 요청을 보낼 수 있도록 허용합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALLOW_COLLECTING_DEVICE_DATA | SDK가 기기 데이터(OS 버전, 로캘, 모델)를 수집하여 서버로 보낼 수 있도록 허용합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALLOW_COLLECTING_DEVICE_OS_VERSION | SDK가 기기의 OS 버전을 수집하여 서버로 보낼 수 있도록 허용합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALLOW_COLLECTING_DEVICE_LOCALE | SDK가 기기 로캘을 수집하여 서버로 보낼 수 있도록 허용합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_ALLOW_COLLECTING_DEVICE_MODEL | SDK가 기기 모델을 수집하여 서버로 보낼 수 있도록 허용합니다. | YES (default) / NO Type: Boolean |
Pushwoosh_LOG_LEVEL | Pushwoosh SDK 로깅 레벨. 자세한 내용은 로그 레벨을 참조하세요. | NONE / ERROR / WARNING / INFO (default) / DEBUG / VERBOSE Type: String |
Pushwoosh_PURCHASE_TRACKING_ENABLED | SDK가 인앱 구매를 추적할 수 있도록 허용합니다. Customer Journey Builder에 필요합니다. | YES / NO (default) Type: Boolean |