iOS 코드 예제
iOS용 Pushwoosh 샘플을 사용하면 프로젝트에 SDK를 통합하지 않고도 Pushwoosh 기능을 탐색하거나 예제 프로젝트에서 Pushwoosh SDK가 어떻게 구현되었는지 검토할 수 있습니다.
전제 조건
Anchor link to예제를 사용하기 전에 다음 사항을 확인하십시오:
Pushwoosh 샘플 애플리케이션
Anchor link to이 프로젝트는 Pushwoosh SDK가 통합된 기본 iOS 애플리케이션으로, 다음과 같은 주요 기능을 보여줍니다:
- 푸시 알림 수신.
- 푸시 알림 전송 추적.
- 사용자 태그 관리.
- 이벤트 전송
- 사용자 등록
샘플 앱을 학습 도구나 개발의 기초로 사용하십시오.
1. 샘플 앱 다운로드
Anchor link to리포지토리를 복제합니다:
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git2. 프로젝트 구성
Anchor link to-
Xcode에서 프로젝트를 엽니다.
-
https://github.com/Pushwoosh/Pushwoosh-XCFramework를 Swift Package Dependency로 추가합니다. -
메인 타겟(PushwooshSampleApp)의 bundle identifier를 Pushwoosh 프로젝트와 일치하도록 설정합니다(예:
com.pushwoosh.PushwooshSampleApp). -
NotificationService 타겟에 대해 동일한 bundle identifier를 사용하고
.NotificationService를 덧붙입니다(예:com.pushwoosh.PushwooshSampleApp.NotificationService). -
Info.plist에서 다음을 설정합니다:Pushwoosh_APPID키: Pushwoosh Application CodePushwoosh_API_TOKEN키: Pushwoosh Device API Token
중요: Pushwoosh Control Panel에서 토큰에 올바른 앱에 대한 액세스 권한을 부여해야 합니다. 자세히 알아보기
3. 프로젝트 실행
Anchor link to- 프로젝트를 빌드하고 실행합니다.
- 앱의 Settings 탭으로 이동합니다.
- Register for Pushes 버튼을 탭합니다.
- 푸시 알림 권한을 부여합니다. 기기가 Pushwoosh에 등록됩니다.
Pushwoosh iOS 예제
Anchor link to다양한 SDK 기능을 다루는 완전한 문서화된 코드 예제를 보려면 pushwoosh-quickstart-ios 리포지토리를 살펴보세요. 이 샘플들은 자체 프로젝트의 참조 또는 시작점으로 바로 사용할 수 있습니다.