Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive API - Objective C - examples? [closed]

I have not been able to find any code examples of accessing the Google Drive API with Objective-C. Does anyone know where to find some? I have the Google Client libraries incorporated into my project, but I don't know how to start with the code.

I am particularly interested in how the authentication works since redirecting to authorization url and then back to the app like you do for web apps doesn't seem like it would work for a native iOS app.

Thanks! Chris

like image 666
user1501783 Avatar asked Feb 14 '26 17:02

user1501783


1 Answers

Support for Objective C is only in alpha stage apparently.

You can find a sample drive application on google code there: http://code.google.com/p/google-api-objectivec-client/source/browse/trunk/Examples/DriveSample/

For authentication you use GTMOAuth2Authentication with an OAuth token, typically stored in the keychain:

// Load the OAuth 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];
like image 142
Julien Lebot Avatar answered Feb 17 '26 10:02

Julien Lebot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!