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 inResult<Void, Error>
of thestop
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.
- This behavior can be disabled by using
The
stop
function is provided in 3 forms:- As an
async
method, which can be called withawait
: stop(invalidatetoken:) - A method with the
completion
callback: stop(invalidatetoken:completion:) - Am Objective-C compatible method: references/v2025/ios/documentation/sensibill/sensibillsdk/stop(invalidatetoken:completion:)
- As an
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 theError
), 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
- Call the
stop
function - Optionally, handle success and failure result of
stop
execution.
Example
import Sensibill
let _ = await SensibillSDK.stop()