Skip to main content

logout

Log out

Feature Introduction

Note

Apps should wait for the logout callback to succeed. After a successful logout, you will no longer receive new messages sent by others. If you are switching accounts, wait for the logout callback of user A to succeed before calling the login for user B, otherwise, the login might fail. If the app's lifecycle is consistent with the SDK's lifecycle, call logout when the user exits the app.

Caution

(1) When receiving OnKickedOffline and OnUserTokenExpired from the SDK, indicating being kicked offline, an invalid token, or an expired token, the SDK will automatically trigger and call logout internally. There's no need to call the logout function externally.

Function Prototype


- (void)logoutWithOnSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

Input Parameters

None

Return Results

Parameter NameParameter TypeDescription
onSuccessOIMSuccessCallbackSuccessful return
onFailureOIMFailureCallbackFailed return

Code Example


[OIMManager.manager logoutWithOnSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];