<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dougt&#039;s blog &#187; 10.6</title>
	<atom:link href="http://dougt.org/wordpress/tag/10-6/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougt.org/wordpress</link>
	<description>best. tagline. ever.</description>
	<lastBuildDate>Mon, 26 Jul 2010 03:18:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>CoreLocation in 10.6</title>
		<link>http://dougt.org/wordpress/2009/09/corelocation/</link>
		<comments>http://dougt.org/wordpress/2009/09/corelocation/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:56:43 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[CoreLocation]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=488</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>The code is pretty simple.  Just something like:</p>
<blockquote><p>CLLocationManager* locationManager = [[CLLocationManager alloc] init];<br />
locationManager.delegate                = self;<br />
locationManager.desiredAccuracy = kCLLocationAccuracyBest;<br />
[locationManager startUpdatingLocation];</p></blockquote>
<p>The delagate is just two functions:</p>
<blockquote><p>- (void)locationManager: (CLLocationManager *)manager<br />
didUpdateToLocation: (CLLocation *)newLocation<br />
fromLocation: (CLLocation *)oldLocation<br />
{<br />
}</p>
<p>- (void)locationManager: (CLLocationManager *)manager<br />
didFailWithError: (NSError *)error<br />
{<br />
}</p></blockquote>
<p>If you put this in your code, you magically get a prompt that looks like this.  &#8220;Untitled&#8221; is the name of my application.</p>
<div id="attachment_486" class="wp-caption aligncenter" style="width: 439px"><a rel="attachment wp-att-486" href="http://dougt.org/wordpress/2009/09/corelocation/screen-shot-2009-09-21-at-10-23-19-am/"><img class="size-full wp-image-486" title="Location Request for &quot;Untitled&quot; application" src="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2009-09-21-at-10.23.19-AM.png" alt="Location Request for &quot;Untitled&quot; application" width="429" height="188" /></a><p class="wp-caption-text">Location Request for &quot;Untitled&quot; application</p></div>
<p>Clicking on the Help icon, you get the following:</p>
<div id="attachment_487" class="wp-caption aligncenter" style="width: 749px"><a rel="attachment wp-att-487" href="http://dougt.org/wordpress/2009/09/corelocation/screen-shot-2009-09-21-at-10-23-38-am/"><img class="size-full wp-image-487" title="Help screenshot" src="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2009-09-21-at-10.23.38-AM.png" alt="Help screenshot" width="739" height="234" /></a><p class="wp-caption-text">Help screenshot</p></div>
<p>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).</p>
<p>The accuracy is pretty good &#8212; it places me at the building I am working from.  Now where is the support for Geolocation in Safari?  <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/09/corelocation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using CoreWLAN on MacOS 10.5</title>
		<link>http://dougt.org/wordpress/2009/09/usingcorewlan/</link>
		<comments>http://dougt.org/wordpress/2009/09/usingcorewlan/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 20:13:28 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[CoreWlan]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[MacOS]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=481</guid>
		<description><![CDATA[When Apple&#8217;s OS X version 10.6 shipped, they broke compatibility will all 3rd party geolocation applications.  This wasn&#8217;t entirely unexpected as we all were using a private framework which wasn&#8217;t documented.  So, Firefox 3.5 and Gears, and probably Skyhook, are busted right now on OS X 10.6. Apple has provided, with limited documentation, a new [...]]]></description>
			<content:encoded><![CDATA[<p>When Apple&#8217;s OS X version 10.6 shipped, they broke compatibility will all 3rd party geolocation applications.  This wasn&#8217;t entirely unexpected as we all were using a private framework which wasn&#8217;t documented.  So, Firefox 3.5 and Gears, and probably Skyhook, are busted right now on OS X 10.6.</p>
<p>Apple has provided, with limited documentation, a new public framework called CoreWLAN.  It looks pretty easy to use.  To do a scan of the WIFI access points, you can simply do:</p>
<blockquote><p>#import &lt;Cocoa/Cocoa.h&gt;<br />
#import &lt;CoreWLAN/CoreWLAN.h&gt;</p>
<p>NSError *err = nil;<br />
NSDictionary *params = nil;</p>
<p>NSArray* scan = [NSMutableArray arrayWithArray:[[CWInterface interface] scanForNetworksWithParameters:params error:&amp;err]];</p></blockquote>
<p>This is all fine and dandy.  However, Firefox uses 10.5, and so using the above code will not compile using the old SDK.  Unfortunately, Apple didn&#8217;t provide any C apis &#8211; only exposing this objective-C API.  So, what I had to do was some objective-c magic.  Check out the reference (http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html)</p>
<p>Basically, we needed to be able to dynamically load the CoreWLAN library, that is simple enough:</p>
<blockquote><p>void *corewlan_library = dlopen(&#8220;/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN&#8221;,  RTLD_LOCAL);</p></blockquote>
<p>Now that this library has been loaded, we want to simulate the objective-c call &#8220;[CWInterface interface]&#8220;.</p>
<blockquote><p>// get the class<br />
Class CWI_class = objc_getClass(&#8220;CWInterface&#8221;);<br />
// register the selector name<br />
SEL interfaceSel = sel_registerName(&#8220;interface&#8221;);<br />
// make the call<br />
id interface = objc_msgSend(CWI_class, interfaceSel);</p></blockquote>
<p>This mess above is the same as:</p>
<blockquote><p>id interface = [CWInterface interface];</p></blockquote>
<p>As you probably can see, it isn&#8217;t that hard to do this, just it is syntactically nasty.  Here is the source to the little application I was testing with:</p>
<blockquote><p>#include &lt;mach-o/dyld.h&gt;<br />
#include &lt;dlfcn.h&gt;<br />
#include &lt;unistd.h&gt;</p>
<p>#include &lt;objc/objc.h&gt;<br />
#include &lt;objc/objc-runtime.h&gt;</p>
<p>Class CWI_class = objc_getClass(&#8220;CWInterface&#8221;);<br />
printf(&#8220;cwi class %x\n&#8221;, CWI_class);</p>
<p>SEL interfaceSel = sel_registerName(&#8220;interface&#8221;);<br />
printf(&#8220;sel: %x\n&#8221;, interfaceSel);</p>
<p>SEL scanSel = sel_registerName(&#8220;scanForNetworksWithParameters:error:&#8221;);<br />
printf(&#8220;scanSel: %x\n&#8221;, interfaceSel);</p>
<p>id interface = objc_msgSend(CWI_class, interfaceSel);<br />
printf(&#8220;interface: %x\n&#8221;, interface);</p>
<p>id scanResult = objc_msgSend(interface, scanSel, 0, 0);<br />
printf(&#8220;scanResult: %x\n&#8221;, scanResult);</p></blockquote>
<p>Hope this helps.  Please let me know of an easier way, if one exists.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/09/usingcorewlan/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
