<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Desktop Core Location</title>
	<atom:link href="http://developer.casgrain.com/?feed=rss2&#038;p=9" rel="self" type="application/rss+xml" />
	<link>http://developer.casgrain.com/?p=9</link>
	<description>Helping you write better Mac software</description>
	<lastBuildDate>Tue, 20 Jul 2010 01:46:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Clipartmag</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-8660</link>
		<dc:creator>Clipartmag</dc:creator>
		<pubDate>Fri, 02 Apr 2010 14:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-8660</guid>
		<description>Тоже думаю добавить в закладки, интересный блог.</description>
		<content:encoded><![CDATA[<p>Тоже думаю добавить в закладки, интересный блог.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-235</link>
		<dc:creator>Philippe</dc:creator>
		<pubDate>Wed, 24 Sep 2008 10:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-235</guid>
		<description>Johannes,

Thanks for taking some time and looking at my code! I guess my inexperience with these newfangled properties shows a little...

For performSelectorOnMainThread:withObject:, you are correct. The retain/release cycle was unnecessary, so I removed it.

In the case of the internal object&#039;s properties, I followed your advice about copy/retain, but I wonder why I would need a -dealloc method. Shouldn&#039;t @synthesize do all of this for me, call -release when a property is retain for instance? Furthermore, properties that are not NSObjects should be assign, as you can&#039;t copy or retain simple types (float, int...).</description>
		<content:encoded><![CDATA[<p>Johannes,</p>
<p>Thanks for taking some time and looking at my code! I guess my inexperience with these newfangled properties shows a little&#8230;</p>
<p>For performSelectorOnMainThread:withObject:, you are correct. The retain/release cycle was unnecessary, so I removed it.</p>
<p>In the case of the internal object&#8217;s properties, I followed your advice about copy/retain, but I wonder why I would need a -dealloc method. Shouldn&#8217;t @synthesize do all of this for me, call -release when a property is retain for instance? Furthermore, properties that are not NSObjects should be assign, as you can&#8217;t copy or retain simple types (float, int&#8230;).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Grynspan</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-205</link>
		<dc:creator>Jonathan Grynspan</dc:creator>
		<pubDate>Fri, 12 Sep 2008 16:29:51 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-205</guid>
		<description>And, I should say, you can listen for @&quot;NSSystemTimeZoneDidChangeDistributedNotification&quot; distributed notifications and update your reported location when they occur.</description>
		<content:encoded><![CDATA[<p>And, I should say, you can listen for @&#8221;NSSystemTimeZoneDidChangeDistributedNotification&#8221; distributed notifications and update your reported location when they occur.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Grynspan</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-204</link>
		<dc:creator>Jonathan Grynspan</dc:creator>
		<pubDate>Fri, 12 Sep 2008 16:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-204</guid>
		<description>If you&#039;re running it on a system that isn&#039;t online at the moment, you could fall back on the less precise &quot;nearest major city&quot; stored by Mac OS X:

BOOL GetCityLatLong(Location *outLocation) {
	id city = [[NSUserDefaults standardUserDefaults] objectForKey: @&quot;com.apple.TimeZonePref.Last_Selected_City&quot;];
	if (city &amp;&amp; [city isKindOfClass: [NSArray class]] &amp;&amp; [city length] &gt;= 2) {
		/* First two elements are the L/L. */
		if (outLocation) {
			outLocation-&gt;latitude = [[city objectAtIndex: 0] doubleValue];
			outLocation-&gt;longitude = [[city objectAtIndex: 1] doubleValue];
		}
		return YES;
	}
	return NO;
}</description>
		<content:encoded><![CDATA[<p>If you&#8217;re running it on a system that isn&#8217;t online at the moment, you could fall back on the less precise &#8220;nearest major city&#8221; stored by Mac OS X:</p>
<p>BOOL GetCityLatLong(Location *outLocation) {<br />
	id city = [[NSUserDefaults standardUserDefaults] objectForKey: @&#8221;com.apple.TimeZonePref.Last_Selected_City&#8221;];<br />
	if (city &amp;&amp; [city isKindOfClass: [NSArray class]] &amp;&amp; [city length] &gt;= 2) {<br />
		/* First two elements are the L/L. */<br />
		if (outLocation) {<br />
			outLocation-&gt;latitude = [[city objectAtIndex: 0] doubleValue];<br />
			outLocation-&gt;longitude = [[city objectAtIndex: 1] doubleValue];<br />
		}<br />
		return YES;<br />
	}<br />
	return NO;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Fortmann</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-203</link>
		<dc:creator>Johannes Fortmann</dc:creator>
		<pubDate>Fri, 12 Sep 2008 12:56:55 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-203</guid>
		<description>Some notes:
- in performSelectorOnMainThread:withObject:, both the receiver and the object are retained. That means you don&#039;t have to do the retain/release dance you&#039;re currently doing.
- your internal object has all its properties marked &quot;assign&quot;. That&#039;s almost certainly not what you want. Specifically, the delegate should be assign, all others should be retain or copy. You&#039;ll have to add a dealloc method, but the rest of your code will be much simpler (e.g. in updateLocation: you won&#039;t have to worry about that ipAddress var which is currently only valid by sheer luck).
Generally, you want to copy any possibly mutable objects (specifically strings), retain all noncopyable objects (like NSThread), and assign only delegates, data sources and the like.
- likewise, is there any reason internal isn&#039;t a property?

HTH, and nice work!,
Johannes</description>
		<content:encoded><![CDATA[<p>Some notes:<br />
- in performSelectorOnMainThread:withObject:, both the receiver and the object are retained. That means you don&#8217;t have to do the retain/release dance you&#8217;re currently doing.<br />
- your internal object has all its properties marked &#8220;assign&#8221;. That&#8217;s almost certainly not what you want. Specifically, the delegate should be assign, all others should be retain or copy. You&#8217;ll have to add a dealloc method, but the rest of your code will be much simpler (e.g. in updateLocation: you won&#8217;t have to worry about that ipAddress var which is currently only valid by sheer luck).<br />
Generally, you want to copy any possibly mutable objects (specifically strings), retain all noncopyable objects (like NSThread), and assign only delegates, data sources and the like.<br />
- likewise, is there any reason internal isn&#8217;t a property?</p>
<p>HTH, and nice work!,<br />
Johannes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-195</link>
		<dc:creator>Philippe</dc:creator>
		<pubDate>Tue, 09 Sep 2008 17:39:08 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-195</guid>
		<description>msr:

That&#039;s correct. The projects build out of the box, and adding a built app to the zip file more than doubles its size.</description>
		<content:encoded><![CDATA[<p>msr:</p>
<p>That&#8217;s correct. The projects build out of the box, and adding a built app to the zip file more than doubles its size.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: msr</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-194</link>
		<dc:creator>msr</dc:creator>
		<pubDate>Tue, 09 Sep 2008 15:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-194</guid>
		<description>You couldn&#039;t give us an Application demo without having to build it?</description>
		<content:encoded><![CDATA[<p>You couldn&#8217;t give us an Application demo without having to build it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Robinson</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-193</link>
		<dc:creator>Paul Robinson</dc:creator>
		<pubDate>Tue, 09 Sep 2008 10:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-193</guid>
		<description>Your presentation was great!   Go Canada!</description>
		<content:encoded><![CDATA[<p>Your presentation was great!   Go Canada!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-192</link>
		<dc:creator>Philippe</dc:creator>
		<pubDate>Tue, 09 Sep 2008 10:47:30 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-192</guid>
		<description>Tom,

The whole thing came about because I don&#039;t have an iPhone and if you use CoreLocation in the Simulator (see PhoneLocation.xcodeproj in the zip file), it reports your location as 1, Infinite Loop, Cupertino, CA...</description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>The whole thing came about because I don&#8217;t have an iPhone and if you use CoreLocation in the Simulator (see PhoneLocation.xcodeproj in the zip file), it reports your location as 1, Infinite Loop, Cupertino, CA&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://developer.casgrain.com/?p=9&#038;cpage=1#comment-191</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Tue, 09 Sep 2008 07:16:11 +0000</pubDate>
		<guid isPermaLink="false">http://developer.casgrain.com/?p=9#comment-191</guid>
		<description>Why not use the iPhone as GPS device and build an IP connection using CoreLocation on the phone sending the data to the DesktopCoreLocation framework. Could be done in various stages like the phone does with carrier locating when GPS is not available yet.</description>
		<content:encoded><![CDATA[<p>Why not use the iPhone as GPS device and build an IP connection using CoreLocation on the phone sending the data to the DesktopCoreLocation framework. Could be done in various stages like the phone does with carrier locating when GPS is not available yet.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
