Supported on: iOS SDK
1.0.61+1. Configure the SDK
Initialize AppDNA as early as possible in your app lifecycle. For UIKit apps, place this inapplication(_:didFinishLaunchingWithOptions:). For SwiftUI apps, use the App initializer.
UIKit
SwiftUI
For background event uploads in SwiftUI apps, use
@UIApplicationDelegateAdaptor and call AppDNA.registerBackgroundTasks() in didFinishLaunchingWithOptions.If you don’t have your own Firebase: Keep
FirebaseApp.configure() as shown above — it initializes AppDNA’s Firebase instance.If you already use Firebase (Analytics, Crashlytics, Realtime Database): Remove the FirebaseApp.configure() call entirely and just call AppDNA.configure(...). The SDK automatically picks up GoogleService-Info-AppDNA.plist and creates its own named Firebase instance. Your existing Firebase setup is not affected.Configuration Options
TheAppDNAOptions struct lets you customize SDK behavior:
Environment
TheEnvironment enum controls which backend environment the SDK targets:
Log Level
TheLogLevel enum controls console log verbosity:
Use
.debug during development to see all SDK activity. Switch to .warning or .none for production builds.Billing Provider
TheBillingProvider enum specifies which billing system owns purchases:
See Billing for the full ownership table and the paywall recipe for
.revenueCat / .adapty.
Notification-proxy settings are Info.plist keys, not runtime options: AppDNADisableNotificationProxy and AppDNAForegroundPresentation — see Push → How push works on iOS.
2. Wait for Ready State
UseonReady to know when the SDK is ready — the bootstrap has succeeded or failed:
onReady does not wait for the remote configuration. When it fires, the SDK serves the cached and bundled config, and the remote fetch may still be running (after a failed bootstrap it starts when a retry succeeds). Use remoteConfig.onChanged to pick up the fetched values.
3. Identify Users
Once a user signs in, callidentify to associate events with their user ID:
Traits are merged with any previously set traits. You do not need to pass all traits on every call — only the ones that have changed.
4. Track Events
Track user actions withtrack:
flushInterval seconds, when the app goes to the background or returns to the foreground, and when the queue reaches a batch size set by the network (100 events on Wi-Fi or a wired connection, metered or not; 20 on a cellular connection the system marks as expensive (iOS) or metered (Android), which is every cellular connection on iOS and most cellular plans on Android; 50 on any other cellular connection). The batchSize option caps it: with a cap, the queue is flushed at the smaller of the two, and no upload sends more.
5. Flush Events Manually
Force an immediate flush of all queued events:6. Set User Consent
Control whether the SDK collects and sends analytics data:7. Remote Config and Feature Flags
Retrieve server-side configuration values:8. Experiments
Get the variant assigned to a user for an experiment:9. Session Data
Store cross-module session data that can be used in template interpolation across onboarding flows, paywalls, and in-app messages:{{session.selected_plan}}.
10. Reset on Logout
When a user signs out, callreset to clear the user identity and flush any remaining events:
You now have the SDK configured, user identification, event tracking, remote config, experiments, and session data working. Continue to the module-specific guides for Push Notifications, Billing, Onboarding, and Paywalls.

