YouTube JSON API Objective-C Client, Without The Pain

Google/YouTube provide a great JSON API to do a variety of operations on data objects on the platform, i.e. videos, playlists, etc. It's a really awesome resource that makes YouTube a valuable asset for a number possible applications. However, taking advantage of the API was a major pain in a recent iOS project, and unnecessarily so! There doesn't seem to be much out there about how to properly setup the API for iOS projects— hence, this post!

While Google provides a number of client libraries for the JSON API, I was surprised how difficult the Objective-C client was to install. I never figured out how to "properly" add the client library to my XCode project, according to the confusing and seemingly outdated documentation on the topic.

Anybody wanting to install the YouTube library for iOS should simply user the iOS-GTLYouTube CocoaPod project on GitHub. brynbellomy figured out this mess, and now the library is available in a CocoaPod, so why would anyone do otherwise now?!

As of early April 2014, after you have the client library setup, make sure to NOT follow Google's instructions to include your project's bundle id in your app settings on the Google API App Console. Otherwise, the API will give a bad response. The issue is being tracked on Google's issue tracker (which is kind of an eye sore), and hopefully will resolve soon. In the meantime, don't let anybody get your access token, or somebody might get a free ride of API requests on your back!

comments powered by Disqus