CoreLocation in 10.6

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?  :-)

This entry was posted in General, mozilla and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Liberty For ALL!
    Posted September 24, 2009 at 11:26 am | Permalink

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

    • Posted September 27, 2009 at 10:16 pm | Permalink

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

  2. Posted October 2, 2009 at 5:32 am | Permalink

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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>