0
votes

i have made an iOS app in Xcode and did a google plus integration for login in it using https://developers.google.com/+/mobile/ios/sign-in The login part runs perfectly ok. but the issue is with logout. actually the problem is after login when i press logout button it does not actually log me out. after logout when i login again instead of asking me username and password it actually stick on the previous user login account i.e logout does not clear the login session after logout.the sign out and disconnect methods does not create any impact .

Below is my signout method which i implement, here on click logout button, segue is performed to login page without logout me out from my authenticating account.also no warnings or error is occurred.

    - (IBAction)signOut:(id)sender {

            [self showSignOutAlertViewWithConfirmationBlock:^(void) {

                [self dismissViewControllerAnimated:YES completion:^{
                    [[GPPSignIn sharedInstance] disconnect];

                    [self performSegueWithIdentifier:@"back_authentication" sender:self];

                }];
               // [[GPPSignIn sharedInstance] signOut];

            }
                                                cancelBlock:^(void) {

                                                }];
               }

In above method i have tried both sign out and disconnect methods but no one does nothing. also i have seen almost all the related posts but nothing helped me.so please suggest me a way to logout.

Thank u in advance.

1
please suggest me a solution of this problem.alankrita sharma

1 Answers

1
votes

Try this code in to logout from google plus

To logout:

- (void)signOut {
  [signIn signOut]; (OR) [[GPPSignIn sharedInstance] signOut];
}

To revoke access tokens:

- (void)disconnect {
  [[GPPSignIn sharedInstance] disconnect];
}

- (void)didDisconnectWithError:(NSError *)error {
  if (error) {
    NSLog(@"Received error %@", error);
  } else {
    // The user is signed out and disconnected.
    // Clean up user data as specified by the Google+ terms.
  }
}