B Bubbl Docs

iOS Quickstart

This is the shortest production-safe flow for integrating Bubbl on iOS.

1) Install SDK + Firebase

Follow Installation and Firebase Setup.

2) Configure AppDelegate order

import FirebaseCore
import FirebaseMessaging
import UserNotifications
import Bubbl

final class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate {

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    FirebaseApp.configure()
    Messaging.messaging().delegate = self
    UNUserNotificationCenter.current().delegate = NotificationManager.shared

    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, _ in
      if granted {
        DispatchQueue.main.async { application.registerForRemoteNotifications() }
      }
    }

    return true
  }

  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Messaging.messaging().apnsToken = deviceToken
    BubblPlugin.updateAPNsToken(deviceToken)
  }

  func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
    guard let token = fcmToken, !token.isEmpty else { return }
    BubblPlugin.updateFCMToken(token)

    BubblPlugin.shared.start(
      apiKey: "YOUR_API_KEY",
      env: .staging,
      segmentations: [],
      delegate: nil
    )
  }
}

3) Trigger tracking

BubblPlugin.shared.requestLocationWhenInUse()
BubblPlugin.shared.requestLocationAlways()
BubblPlugin.shared.refetchGeofence()

4) Render modal from notification payloads

Use NotificationManager.shared.publisher to drive your own modal UI and survey handling.

See Notifications and Modal Styling.