Skip to main content

Clear All Sessions

You can remove all locally stored Suki sessions from the device by calling the clear() method. The primary use case for this method is to clear user-specific data when a user signs out of your application. This ensures data privacy and prepares the SDK for a new user session.
Do not call the clear() method during an active session; this will throw an error.
do {
    // Removes all persisted session data from the device.
    try SukiAmbientCore.shared.clear()
} catch {
    // Handle potential errors.
    print(error)
}

FAQs

The clear() method is used to clear all locally stored Suki sessions from the device. If you call this method during an active session, it will throw an error.
The clear() method is not working because the SDK is not initialized. You must ensure that the SDK is initialized before calling the clear() method.
You can check the sessionState property to determine the current state of the session.
The data is not being deleted because the SDK is not initialized. You must ensure that the SDK is initialized before calling the clear() method.
You can initialize the SDK by calling the initialize() method.

Next Steps

After you clear the sessions, proceed to our Session Events & Delegates guide to listen to the session events.
I