我从google开发人员下载google-api-objectivec-client-read-only.zip,然后将lib导入我的xcode项目。但我不知道如何使用google-api-objective-client来使用oauth2访问google驱动器。 我的代码:
- (void)oauth2access {
// Load the OAuth 2 token from the keychain, if it was previously saved.
NSString *clientID = [_clientIDField stringValue];
NSString *clientSecret = [_clientSecretField stringValue];
GTMOAuth2Authentication *auth;
auth = [GTMOAuth2WindowController authForGoogleFromKeychainForName:kKeychainItemName
clientID:clientID
clientSecret:clientSecret];
self.driveService.authorizer = auth;
// Set the result text fields to have a distinctive color and mono-spaced font.
[_fileListResultTextField setTextColor:[NSColor darkGrayColor]];
[_detailResultTextField setTextColor:[NSColor darkGrayColor]];
NSFont *resultTextFont = [NSFont fontWithName:@"Monaco" size:9];
[_fileListResultTextField setFont:resultTextFont];
[_detailResultTextField setFont:resultTextFont];
[self updateUI];
}
运行程序,程序崩溃了。 如何访问谷歌驱动器使用objc与oauth2?