Supported on: iOS SDK
1.0.61+Config Resolution Priority
The SDK resolves configuration using a three-tier priority system:The SDK uses a stale-while-revalidate pattern. Cached config is served immediately, whatever its age, while a fresh copy is fetched from the remote source in the background. If that fetch fails, the cached config stays in use.
Config TTL
The cached configuration has a time-to-live (TTL) that defaults to 3600 seconds (1 hour). You can customize this value inAppDNAOptions:
Config Update Notifications
Listen for config updates usingNotificationCenter:
Bundled Config
For first-launch scenarios or environments with no network access, include a static configuration file in your app bundle:- In the AppDNA Console, open Settings → SDK → Config Bundle. The bundle is regenerated automatically shortly after each publish (usually within about 20 seconds); click Regenerate only if you need it at once.
- Click JSON Only. It saves
appdna-config.jsonin the form the SDK reads. To download it in CI instead, see Config Bundles in CI/CD. - Add the file to your Xcode project, ensuring it is included in your app target’s Copy Bundle Resources build phase.
Event Queue
Events tracked withAppDNA.track(...) are not sent immediately. They are queued locally and flushed in batches.
Queue Behavior
Events are flushed on the timer, when the app goes to the background or returns to the foreground, and when the queue reaches the batch size (the adaptive size below, capped by
batchSize when set) — whichever comes first.
Persistence
Events are persisted to disk immediately when tracked. This ensures that:- Events survive app crashes and force quits.
- Events survive app restarts and device reboots.
- Events are delivered on the next successful flush after connectivity is restored.
The event queue is stored in the app’s Application Support directory. Events stay queued until they are delivered or dropped: a batch rejected with a 4xx other than 408 or 429, the oldest events beyond 10,000 events or 5 MB, events older than 7 days, and every queued event when analytics consent is revoked. See When Events Are Dropped.
Adaptive Batch Sizing
The SDK automatically adjusts batch size based on network conditions:- Wi-Fi or wired: 100 events per batch, whether or not iOS marks the connection expensive
- Cellular marked expensive: 20 events per batch. iOS marks every cellular connection expensive, so this is the cellular case in practice
- Cellular not marked expensive: 50 events per batch
batchSize set, the batch size is the smaller of this size and batchSize.
Event Storage Limits
Events are stored locally with the following limits:- Maximum 10,000 events in queue
- Maximum 5 MB of queued events: each event’s JSON plus a line break. Sent and dropped events stay in the file until the SDK reclaims their space — once they pass 1 MB, or outweigh the queued ones — so the file itself can reach about 6 MB
Retry Policy
When a flush attempt fails, the SDK retries with exponential backoff:Error Handling
Circuit Breaker
After 5 consecutive upload failures, event uploads are paused: the timer, the batch size and backgrounding do not start an upload (backgrounding schedules no OS background upload, and one already scheduled uploads nothing while paused). Returning to the foreground or callingAppDNA.flush() resets the failure count and resumes uploads. A single failure does not pause uploads, except a 401 or 403 (an invalid or revoked API key): every later batch would be rejected the same way, so it pauses uploads at once, in the in-app queue and the OS background upload alike. Every other failed flush counts toward the consecutive-failure total — whether a 4xx batch was dropped or a 5xx/network error left the batch queued for retry — and only the 5th failure in a row trips the circuit breaker. An OS background upload ends its run after a rejected batch; its next run sends the events behind it.
Network Timeouts
Consent and Offline Behavior
When analytics consent is set tofalse:
Consent state is persisted. If a user revokes consent and restarts the app, the SDK remembers the revoked state and continues to drop events until consent is explicitly granted again.
Secure Storage
The following data is stored in the iOS Keychain for security:
Keychain storage ensures these values persist across app reinstalls and are protected by the device’s hardware encryption.

