Passer au contenu

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 to

Pour 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 to

Clonez le projet d’exemple depuis GitHub :

Terminal window
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git

Configurer le projet

Anchor link to
  1. Open the project in Xcode.

  2. Add https://github.com/Pushwoosh/Pushwoosh-XCFramework as Swift Package Dependency.

  3. Set the bundle identifier for the main target (PushwooshSampleApp) to match your Pushwoosh project (e.g., com.pushwoosh.PushwooshSampleApp).

  4. Use the same bundle identifier for the NotificationService target, appending .NotificationService (e.g., com.pushwoosh.PushwooshSampleApp.NotificationService).

  5. In Info.plist, set the:

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
  1. Compilez et exécutez le projet.
  2. L’application aura deux onglets : « Actions » et « Settings ». Accédez à l’onglet Settings.
  3. Appuyez sur le bouton Register for Pushes.
  4. Autorisez les notifications push. L’appareil sera alors enregistré auprès de Pushwoosh.

Vous devriez voir une entrée de journal similaire à celle-ci :

Terminal window
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 to

Retournez dans le Control Panel de Pushwoosh et envoyez une notification push à votre appareil enregistré.

Prochaines étapes

Anchor link to

Pour en savoir plus, veuillez consulter le guide d’intégration de base