uninitialize
SDK Uninitialization
Reset SDK initialization and user authentication state. Call this when logging out, switching accounts or environments, or preparing to initialize the SDK again.
Method Declaration
objectivec
+ (void)uninitialize;Runtime Behavior
- Clear the SDK's user token, identity and authentication signature record, stop user ping, and invalidate old authentication results so late callbacks cannot restore authentication.
- Clear SDK initialization configuration and unregister the listener installed through setAuthInvalidatedListener:. Suppress pending old invalidation notifications. Uninitialization itself does not trigger
onAuthInvalidated. - Do not clear the app's own login state. The host must stop signature retrieval and authentication retries for the old account and invalidate old business callbacks. The Demo's shared integration layer ends its old recovery flow when the SDK is uninitialized.
- The host manages game task and handle destruction according to their lifecycles. This method is not a game destruction API. Do not call it just to restart a game after authentication invalidation.
Example Code
objectivec
// First stop signature retrieval and authentication recovery for the old account.
// Destroy that account's game task when required by the host's business lifecycle.
[self.gameTask destroy];
self.gameTask = nil;
[SUDOP uninitialize];
// To reconnect: initialize successfully, register the listener again,
// then obtain a fresh signature and call auth.If you only retain a game handle, release it with destroy. If you retain a startup task, use SUDOPGameTask destroy.
Notes
- Pair this method with initializeWithConfiguration:completion:. Complete initialization and user authentication before using the SDK again.
- Repeated calls do not restore old authentication or emit invalidation notifications. Register the listener again when reconnecting, because uninitialization unregisters it.
- See authWithUserSignature:completion: and the invalidation listener for recovery after explicit authentication failure or invalidation during gameplay.
