简体   繁体   中英

Google Drive API Issue iOS

I have successfully integrated the Google Drive API with iOS, however there seems to be a major issue with the Drive OAuth process: There's no button for the user to press to resign the ModalViewController to enter in this code....

在此处输入图片说明

Google really was an absolute pain in the ass this time around. They made a mistake in their example code:

For anyone else trying to do this in the future, add [viewController dismissViewControllerAnimated:NO completion:nil]; to the following method:

// Handle completion of the authorization process, and updates the Drive service
// with the new credentials.
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
      finishedWithAuth:(GTMOAuth2Authentication *)authResult
                 error:(NSError *)error
{
    if (error != nil)
    {
        [self showAlert:@"Authentication Error" message:error.localizedDescription];
        self.driveService.authorizer = nil;
    }
    else
    {
        self.driveService.authorizer = authResult;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM