Troubleshooting
initialize()’s completion resolves false, or crashes in debug
If neither setApiKey() nor the OneSygnalApiKey Info.plist entry resolves to a
non-blank string, initialize() fails before resolving the completion. In a debug
build, this crashes the app. In a release build, you just get completion?(false)
(or await initialize() returning false) with no crash. Android reports false in both
configurations.
The crash message is:
OneSygnal API key not found. Add key "OneSygnalApiKey" with your API key to your app's Info.plist.Fix: add the OneSygnalApiKey key to Info.plist, or call setApiKey() before
initialize().
setApiKey() doesn’t seem to do anything
Two silent-no-op cases:
- Blank string.
setApiKey("")(or all-whitespace) is a no-op — it leaves any prior override, or the plist key, in place, rather than clearing it or throwing. - Called after
initialize(). The key is read once, atinitialize()time. CallingsetApiKey()afterward has no effect until the nextinitialize()(e.g. aftershutdown()).
isInitialized() returned true, but surveys never showed and track() calls fail
isInitialized() can report true briefly before setup has actually finished — there’s a
window where it reports true while the SDK is still fetching config and surveys in the
background. If the account isn’t active, initialize()’s completion later resolves with
false even though isInitialized() briefly read true in the meantime. Use the
initialize() completion/await result or the ready event (see
Events) rather than polling isInitialized().
A call I made returned false / did nothing
track() returns false (a genuine return value, not queued) if the SDK isn’t
initialized yet, or if setSurveysEnabled(false) is in effect. identify(), logout(),
reset(), and shutdown() all no-op (their completion still fires, with false for
identify) if called before initialize() has completed — there is no call-queuing on
iOS the way the web loader queues pre-ready calls. Call these only after initialize()’s
completion (or ready) has fired.
Survey didn’t show even though a trigger should have matched
The survey fails to show if there’s no foreground scene available at the moment of the attempt — nothing is shown, with no error surfaced. This can happen if the trigger fires while the app is backgrounded or between scene transitions. There is no retry — the next trigger match gets its own attempt.