Skip to Content
PlatformsiOSConfiguration

Configuration

API key

Read from Info.plist by default — key OneSygnalApiKey:

<key>OneSygnalApiKey</key> <string>YOUR_API_KEY</string>

Or override in code with setApiKey(), which must be called before initialize() — the key is only read once, at initialize() time, so calling it afterward is a silent no-op:

OneSygnal.shared.setApiKey("YOUR_API_KEY") OneSygnal.shared.initialize()

A blank string passed to setApiKey() is also a silent no-op (leaves any prior override, or the plist key, in place) rather than trapping. initialize() is the one place a resolved-but-missing key is reported — see Troubleshooting.

If both are set, setApiKey() takes precedence over the OneSygnalApiKey Info.plist entry.

Locale

Defaults to the device’s preferred language (Locale.preferredLanguages.first, falling back to "en-US"). Override with setLocale():

OneSygnal.shared.setLocale("fr-FR")

Unlike setApiKey(), setLocale() is live-reactive: called after initialize() has already run, it immediately updates the Accept-Language header used for all subsequent requests and triggers a fresh config/surveys fetch under the new locale — no app restart needed. Called before initialize(), it just sets the locale that call will use. Web has no equivalent — its locale is fixed at init() time.

No init options object

Unlike web’s init(apiKey, options), initialize() takes only an optional completion — there’s no options argument. Settings like session timeout, survey cooldown periods, daily display caps, and rate limits are server-configured rather than set at initialization.

Debug logging

The iOS SDK logs diagnostics via os_log. During development, filter for the OneSygnal subsystem in Console.app or Xcode’s console to see SDK lifecycle events, trigger evaluations, and network requests.

What exists here but not on web

reset(), setApiKey(), and setLocale() all exist on iOS (and Android) but not on web:

  • reset() — mints a new anonymous ID and re-fetches surveys, distinct from logout(). Web has never distinguished “clear the identified user” from “mint a new anonymous ID,” so it has no equivalent.
  • setApiKey() — see above; web takes the key as init()’s argument instead.
  • setLocale() — see above; web’s locale is fixed at init() time by design.

See the full Platform Parity table for every operation.