Chapter 10. Geolocation
The example in this chapter shows how to write an application
that uses the user’s geographical location and a location web service. To do
that, we are going to use the
CoreLocation framework, the
gowalla.com web API (offering location information
based on coordinates), and a
As before, we start by creating a MacRuby application using Xcode. Start Xcode and choose the MacRuby template. In the template settings, set the Product Name to “AroundMe” and disable the Document-Based and Core Data options.
In this example, the UI will be very simple. We are going to
work with just an
NSTableView instance and
a bunch of columns (
Edit your .xib file and resize the main window to be 640 pixels by 440 pixels (use the Size Inspector in the Utilities panel). Now drag and drop a Table View from the Object Library inside the Window’s view. Using the grid guides, scale the table to use most of the window’s real estate.
At this point, make sure the AroundMe scheme is selected and click Run. The app should look like Figure 10-1.
Figure 10-1. Blank Table View
We are going to use the Gowalla API to find the locations (called spots in Gowalla’s jargon) around our users. You can see the type of information the API provides us by going to the following page: http://gowalla.com/api/explorer#/spots?lat=30.2697&lng=-97.7494&radius=50.
We can’t ...