Skip to content

CoreLocation in 10.6

September 21, 2009

I took a really quick look at the built-in location services on Mac 10.6.  I wanted to determine what sort of accuracy the feature had out-of-the-box, and what the API looked like.

The code is pretty simple.  Just something like:

CLLocationManager* locationManager = [[CLLocationManager alloc] init];
locationManager.delegate                = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];

The delagate is just two functions:

- (void)locationManager: (CLLocationManager *)manager
didUpdateToLocation: (CLLocation *)newLocation
fromLocation: (CLLocation *)oldLocation
{
}

- (void)locationManager: (CLLocationManager *)manager
didFailWithError: (NSError *)error
{
}

If you put this in your code, you magically get a prompt that looks like this.  “Untitled” is the name of my application.

Location Request for "Untitled" application

Location Request for "Untitled" application

Clicking on the Help icon, you get the following:

Help screenshot

Help screenshot

The network requests goes to mac-services.apple.com.  The good news is that it is over a secure network channel.  The bad news is that the content is also hidden from inspection.  (eg.  since this is close source, Apple could be passing anything.  The thing that worries me is that it might be passing the application name which would give unfair Apple insight into what applications are popular).

The accuracy is pretty good — it places me at the building I am working from.  Now where is the support for Geolocation in Safari?  :-)

From → Uncategorized

3 Comments
  1. Liberty For ALL! permalink

    How about posting a list of 10.6 CoreLocation capable applications? ;-)

    • no idea of who is using CoreLocation, but I would expect many apps to making use of it.

  2. Download my experimental Snow Leopard CoreLocation app “Lucubrator” (with source code) here:.

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.