Skip to content
PreviewNot live yet. APIs and SDKs on these pages may change before launch.

iOS

Prerequisites: iOS 15+, an app in Settings → Apps with an iOS client key, and an APNs key. Read Concepts.

  1. Add the package https://github.com/mailpidge/mailpidge-swift (product MailPidgeLifecycleSDK).

  2. In Signing & Capabilities, add Push Notifications, App Attest, and Background Modes → Remote notifications.

  3. Configure at launch.

    import MailPidgeLifecycleSDK
    do {
    try MailPidgeLifecycle.configure(clientCredential: "mpck_…", appId: "pidgefit-ios")
    } catch {
    assertionFailure("MailPidge configuration is invalid: \(error)")
    }

    Debug builds: add pushEnvironment: .sandbox.

  4. Request permission and register the token.

    if try await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {
    UIApplication.shared.registerForRemoteNotifications()
    }
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Task { try await MailPidgeLifecycle.registerPushToken(deviceToken) }
    }
  5. Identify after sign-in; reset on sign-out.

    try await MailPidgeLifecycle.identify(externalUserId: user.id, identityToken: identityToken)
    await MailPidgeLifecycle.reset()
  6. Track events and record consent.

    try await MailPidgeLifecycle.track("workout_completed", properties: ["minutes": 42])

Add a Notification Service Extension with the MailPidgeNotificationServiceExtension product and an App Group shared with the app. It attaches images and reports push.confirmed.

On a real device: Settings → Apps → your app → Send test push. The device shows as Active.