Démarrage rapide du SDK iOS
Démarrez avec le SDK iOS de Pushwoosh en utilisant cet exemple simple et rapide.
Prérequis
Anchor link toPour intégrer le SDK iOS de Pushwoosh dans votre application, vous aurez besoin des éléments suivants :
Télécharger le projet d’exemple
Anchor link toClonez le projet d’exemple depuis GitHub :
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git
Configurer le projet
Anchor link toOpen the project in Xcode.
Add
https://github.com/Pushwoosh/Pushwoosh-XCFramework
as Swift Package Dependency.Set the bundle identifier for the main target (PushwooshSampleApp) to match your Pushwoosh project (e.g.,
com.pushwoosh.PushwooshSampleApp
).Use the same bundle identifier for the NotificationService target, appending
.NotificationService
(e.g.,com.pushwoosh.PushwooshSampleApp.NotificationService
).In
Info.plist
, set the:Pushwoosh_APPID
key to the Pushwoosh Application CodePushwoosh_API_TOKEN
key to the Pushwoosh Device API Token
Important: Be sure to give the token access to the right app in your Pushwoosh Control Panel. Learn more
Exécuter le projet
Anchor link to- Compilez et exécutez le projet.
- L’application aura deux onglets : « Actions » et « Settings ». Accédez à l’onglet Settings.
- Appuyez sur le bouton Register for Pushes.
- Autorisez les notifications push. L’appareil sera alors enregistré auprès de Pushwoosh.
Vous devriez voir une entrée de journal similaire à celle-ci :
Pushwoosh: Initializing application runtime[PW] BUNDLE ID: __YOUR_BUNDLE_ID__[PW] APP CODE: __YOUR_APP_CODE__[PW] PUSHWOOSH SDK VERSION: 6.7.13[PW] HWID: __YOUR_HWID__[PW] PUSH TOKEN: (null)[PW] [I] -[PWNotificationManagerCompatiOS10] NotificationCenter authorization granted: 1[PW] [I] -[PWPushNotificationsManagerCommon] Registered for push notifications: __YOUR_PUSH_TOKEN__
Votre appareil est maintenant enregistré auprès de Pushwoosh.
Envoyer une notification push
Anchor link toRetournez dans le Control Panel de Pushwoosh et envoyez une notification push à votre appareil enregistré.
Prochaines étapes
Anchor link toPour en savoir plus, veuillez consulter le guide d’intégration de base