Pre-built customizable chat UI - Logout User

Applozic Core SDK

Logout User

Call the following code when a user logs out from your app:

ALRegisterUserClientService *registerUserClientService = [[ALRegisterUserClientService alloc] init];
[registerUserClientService logoutWithCompletionHandler:^(ALAPIResponse *response, NSError *error) {
    if(!error && [response.status isEqualToString:@"success"])
    {
        NSLog(@"Logout success");
    }
    else
    {
        NSLog(@"Logout failed with response : %@",response.response);
    }
    }];
let registerUserClientService: ALRegisterUserClientService = ALRegisterUserClientService()
registerUserClientService.logout { (response, error) in
            if(error == nil && response.status == "success") {
            NSLog("Logout success")
       } else {
            NSLog("Logout failed with response : %@", response.response)
       }
     }

ApplozicSwift SDK

Logout user will log out from the Applozic server and clears locally stored data of the logged-in user of Applozic.

Call the following code when a user logs out from your app:

ALChatManager.shared.logoutUser { _ in
  // User is logout 
}
[ALChatManager.shared logoutUserWithCompletion:^(BOOL sucess) {
     if (sucess) {
        NSLog(@"Logout success");
     }
}];

Build your UI from scratch - Logout user

Logout User

Logout the user from Applozic. It will clear complete local data of the logged in user.

ALRegisterUserClientService *registerUserClientService = [[ALRegisterUserClientService alloc] init];
[registerUserClientService logoutWithCompletionHandler:^(ALAPIResponse *response, NSError *error) {
    if(!error && [response.status isEqualToString:@"success"])
    {
        NSLog(@"Logout success");
    }
    else
    {
        NSLog(@"Logout failed with response : %@",response.response);
    }
    }];
let registerUserClientService: ALRegisterUserClientService = ALRegisterUserClientService()
registerUserClientService.logout { (response, error) in
            if(error == nil && response.status == "success") {
            NSLog("Logout success")
       } else {
            NSLog("Logout failed with response : %@", response.response)
       }
     }

📘

NOTE

Once you log out user you need to reinitialize ApplozicClient as complete local data is cleared for current login user you need re-setup the applozic applicationKey link


What’s Next
Did this page help you?