Ich möchte mit Google Drive in meiner iOS-App integrieren.iOS Google Drive-Integration
Ich habe den Code für die Autorisierung gemacht und ich bekomme den accessToken zurück, also möchte ich wissen - wohin ich von dort in Bezug auf das Abrufen der PDF-Dateien von Google Drive komme.
Mein Login-Code:
- (IBAction)signInButtonTapped:(id)sender {
NSURL *issuer = [NSURL URLWithString:kIssuer];
NSURL *redirectURI = [NSURL URLWithString:kRedirectURI];
[self logMessage:@"Fetching configuration for issuer: %@", issuer];
// discovers endpoints
[OIDAuthorizationService discoverServiceConfigurationForIssuer:issuer
completion:^(OIDServiceConfiguration *_Nullable configuration, NSError *_Nullable error) {
if (!configuration) {
[self logMessage:@"Error retrieving discovery document: %@", [error localizedDescription]];
[self setAuthState:nil];
return;
}
[self logMessage:@"Got configuration: %@", configuration];
// builds authentication request
OIDAuthorizationRequest *request =
[[OIDAuthorizationRequest alloc] initWithConfiguration:configuration
clientId:kClientID
scopes:@[OIDScopeOpenID, OIDScopeProfile]
redirectURL:redirectURI
responseType:OIDResponseTypeCode
additionalParameters:nil];
// performs authentication request
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
[self logMessage:@"Initiating authorization request with scope: %@", request.scope];
appDelegate.currentAuthorizationFlow =
[OIDAuthState authStateByPresentingAuthorizationRequest:request
presentingViewController:self
callback:^(OIDAuthState *_Nullable authState,
NSError *_Nullable error) {
if (authState) {
[self setAuthState:authState];
[self logMessage:@"Got authorization tokens. Access token: %@", authState.lastTokenResponse.accessToken];
[self logMessage:@"Got authorization tokens. Refresh Access token %@", authState.refreshToken];
} else {
[self logMessage:@"Authorization error: %@", [error localizedDescription]];
[self setAuthState:nil];
}
}];}];}
Möglicherweise möchten Sie [Herunterladen von Google-Dokumenten] (https://developers.google.com/drive/v3/web/manage-downloads#downloading_google_documents) aktivieren. Das Beispiel zeigt, wie Sie ein Google-Dokument mit den Client-Bibliotheken im PDF-Format herunterladen können. Sie können auch in der Tabelle der unterstützten MIME-Exporttypen nachsehen, um den entsprechenden MIME-Typ für jedes Google Doc-Format zu erhalten. Weitere Informationen erhalten Sie in der [vollständigen iOS-Dokumentation] (https://developers.google.com/drive/ios/). – Teyam
@ Sipho Koza, welche URL muss als redirectURI gesetzt werden? Ich stecke hier fest, muss es auch zur Entwicklerkonsole hinzugefügt werden? Bitte helfen Sie. –