Key Concepts: Dictionaries, APIs, NSURLConnection

Web services APIs open up a world of possibilities for your apps. Through them, you can consume data from just about any web platform available and integrate it's data natively into your own app.

API calls are most powerful when made asynchronously, that means that the application does not wait for a response, it just keeps on moving. When the api call returns, that block of code will be executed with the data returned.

Watch out! The thing to remember is that the code immediately following the block will be run BEFORE the block is run.

Data returned from an API call will likely be in the form of JSON data. iOS can natively turn that JSON data into either an NSArray or an NSDictionary. JSON data can look unwieldy but don't be intimidated, it's just a matter of traversing NSArrays and NSDictionaries. In time, your eyes will adjust to the syntax.

NSDictionaries are collections, tuples, of keys and values. There is a one-to-one relationship between a key and a value. Think of keys and values like actual, physical dictionary entries where the keys are the words and the values are the definitions.

You access data from dictionaries by key. We use the objectForKey: method for this. Keys are typically strings.