Has anyone integrated google docs into their iOS app? Having gone through the example code, the API for Google Docs is far more complicated than I would have expected, and the examples are all MacOS. Yes there is iOS support, but there is a distinct lack of example code on how to use it, and the documentation is somewhat lacking.
I did find an interface class on the web, but it was based on an older, deprecated version of the Google Docs API, and it doesn’t compile with XCode 4.2.
What I’m after is a relatively straight forward interface that allows:
- Logging in/out from a google docs account.
- Getting a list of documents within that account (optionally of a specific type), possibly with the ability to navigate a folder structure.
- Being able to download a specific document to local storage.
- Being able to upload a specific document to google docs.
I’ve started writing such an interface, but so far it’s way more involved than I had allowed for. If anyone has any suggestions, or samples that they can direct me to, I’d really appreciate it.
My preference is for the wrapper to be OS neutral; meaning I want to be able to use the same interface in both MacOS and iOS. Again, this is what I’ve started writing, but I can’t help feeling that I must be reinventing the wheel here.
Thanks
OK, so in the absence of any answers from others, I bit the bullet and wrote a wrapper myself.
I now have single wrapper that works for both Mac OS and iOS that dramatically simplifies the interface with Google Docs.
Below is all of the code for the actual interface. I should point out that this class acts as a singleton, and you need to customise it slightly for each project by updating the lines:
with the appropriate values you get from Google.
I also point out that the class stores passwords via NSUserDefaults, and uses a separate utility class to do this in an encrypted fashion. Rather than clog this answer here with all of that extra code, I’ve created a repository in bitbucket at:
https://bitbucket.org/pkclsoft/gdatainterface
which contains an entire XCode project that builds two targets, one for Mac OS and one for iOS. Ive used those both in an app that is in the app store now with great results. It may be that whilst this project builds for me you have to tweak it for your purposes. The project contains a complete set of the Google SDK that builds and runs with my code. I included it to try and reduce the risk of incompatibilities with newer versions of the SDK for anyone grabbing it.
Here is the interface spec as it currently stands:
And here is the implementation: