RSNetflixEngine is a useful library to communicate with the Netflix API.
-
Check out the code from github:
git clone git://github.com/rsattar/RSNetflixEngine.git
-
Supply your own API key and shared secret and application name. You'll need to copy
APIKeys.h.template
asAPIKeys.h
, and fill in the three macros there. If you don't have these yet, get one from Netflix at http://developer.netflix.com/member/register . -
Build and run RSNetflixEngine. The XCode project is an executable iOS project that runs sample code and lets you try out the functionality of RSNetflixEngine.
Unfortunately XCode isn't as awesome in cross-project development as other IDEs, so the easiest way is to actually just copy the source code to your project.
- Copy all the relevant source files into your own project. You need everything that under the "Source" group within XCode. This includes RSNetflixEngine, RSURLLoader, RSNetflixAPIContext, RSNetflixAPIRequest, etc.
- You also need to copy
APIKeys.h
, or have those macros defined somewhere (seeAPIKeys.h.template
). - Instantiate a
RSNetflixAPIContext
instance, and create anRSNetflixEngine
instance (orRSNetflixAPIRequest
if you want to do things a bit more low level, or aren't implemented inRSNetflixEngine
yet.)
RSNetflixEngine can be used in 2 different ways:
- By creating
RSNetflixAPIRequest
objects for each API request. This requires you know more about the Netflix API, as this is just a fancy convenience class to build a query and send it to the Netflix api server. - By creating an
RSNetflixEngine
instance, which provides more convenient methods for each type of API request. This class createsRSNetflixAPIRequest
instances for you, by supplying properly formatted information.
Responses from Netflix in either approach can be handled using delegate callbacks, or blocks.