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
stopfunction 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 thestopfunction.- 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
Errorshould not be considered as failure to stop, rather a failure to invalidate the token.
- This behavior can be disabled by using
The
stopfunction is provided in 3 forms:- As an
asyncmethod, which can be called withawait: stop(invalidatetoken:) - A method with the
completioncallback: 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
stopfunction having a network connection is optimal, but the SDK will stop and reset its state locally regardless. - Once the
stopfunction is complete (and regardless of whether it retuns theError), the SDK can be started again. - If
stopwas 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
stopfunction 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
stopfunction - Optionally, handle success and failure result of
stopexecution.
Example
import Sensibill
let _ = await SensibillSDK.stop()