O'Reilly logo

iPhone Location Aware Apps by Example by Zeeshan Chawdhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — consuming the Patch News API

Having looked at the working of the Patch News API, let us fire some code to consume the News services by user's location. We will use the location manager for managing the user's location as before, SQLite for storing the taxonomy and news for offline usability, and UITableView for the display.

As in the case of the events app, we will create the database structure for the following:

  • Storing the latest news entries
  • Storing the category or the taxonomy in the case of Patch News API
  • Storing the user's last known location
  1. So, we create the news table in a database named packtnews.sqlite, as follows:
    CREATE TABLE IF NOT EXISTS "news" ("uuid" VARCHAR UNIQUE , "title" VARCHAR, "summary" TEXT, "story_url" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required