Stopping iOS SDK

The stop function will always clean the local state of the SDK, so it’s always safe to run start after stop has completed. Additionally, there are a few customizations an integrator can make in order to better accommodate the stop function for their needs:

  • By default the stop function will first attempt to call Sensibill’s backend to invalidate the user token and clear the user session. The result of the remote call will be returned in Result<Void, Error> of the stop function.

    • This behavior can be disabled by using stop(invalidateToken: false).
    • Even in case the remote token invalidation fails, the local state will be cleared, so the returned Error should not be considered as failure to stop, rather a failure to invalidate the token.
  • The stop function is provided in 3 forms:

Notes:

  • The caller must wait for the stop callback to return before attempting to start the SDK again.
  • For the stop function having a network connection is optimal, but the SDK will stop and reset its state locally regardless.
  • Once the stop function is complete (and regardless of whether it retuns the Error), the SDK can be started again.
  • If stop was called while the application is starting, stop may need to wait to be able to interrupt the start.
  • The stop function cannot run if another stop function is already in progress.
  • Calling stop on already stopped SDK is supported (clears local state only). This can be done in cases when it’s desired to ensure that the SDK is in clear stoppped state.

Steps

  1. Call the stop function
  2. Optionally, handle success and failure result of stop execution.

Example

import Sensibill

let _ = await SensibillSDK.stop()