<?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>g-Off.net &#124; Geoffrey Foster &#187; Objective-C</title>
	<atom:link href="http://g-Off.net/tag/objective-c/feed" rel="self" type="application/rss+xml" />
	<link>http://g-Off.net</link>
	<description></description>
	<lastBuildDate>Fri, 30 Oct 2009 00:12:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CLLocation forward GeoLocation method</title>
		<link>http://g-Off.net/software/cllocation-forward-geolocation-method</link>
		<comments>http://g-Off.net/software/cllocation-forward-geolocation-method#comments</comments>
		<pubDate>Mon, 17 Aug 2009 03:54:42 +0000</pubDate>
		<dc:creator>gfoster</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[CoreLocation]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://g-Off.net/?p=93</guid>
		<description><![CDATA[The new MapKit framework for the iPhone OS 3.0 provides a very easy to use way of doing reverse geolocation (getting address information by providing latitude and longitude). But, it would seem that there is nothing built in for getting latitude and longitude values for a given address. Luckily, Google to the rescue! The following [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://g-Off.net/wp-content/uploads/2009/08/sdk_icon4.png" alt="iPhone Maps App icon" title="iPhone Maps App icon" width="66" height="79" class="alignleft size-full wp-image-117" />The new MapKit framework for the iPhone OS 3.0 provides a very easy to use way of doing reverse geolocation (getting address information by providing latitude and longitude). But, it would seem that there is nothing built in for getting latitude and longitude values for a given address. Luckily, Google to the rescue! <span id="more-93"></span>The following code-snippet is a category on CLLocation with the one method</p>

<div class="wp_codebox"><table><tr id="p933"><td class="code" id="p93code3"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>locationUsingForwardGeoLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>address;</pre></td></tr></table></div>

<p> which takes an address string, and, using Google maps API, does a lookup and returns a CLLocation object for the given address. If no address could be found then nil is returned.</p>
<p>Usage is very simple:</p>

<div class="wp_codebox"><table><tr id="p934"><td class="code" id="p93code4"><pre class="objc" style="font-family:monospace;">CLLocation <span style="color: #002200;">*</span>ottawa <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>CLLocation locationUsingForwardGeoLocation<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Ottawa, Ontario&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">// Do whatever with the returned CLLocation object</span></pre></td></tr></table></div>

<p>CLLocation+ForwardGeoLocation.h <a href="http://bitbucket.org/g_Off/utilities/src/tip/cocoa/iphone/CLLocation+ForwardGeoLocation.h">View</a><br />
CLLocation+ForwardGeoLocation.m <a href="http://bitbucket.org/g_Off/utilities/src/tip/cocoa/iphone/CLLocation+ForwardGeoLocation.m">View</a></p>
<p><a href="http://bitbucket.org/g_Off/utilities/issues/new/">Report any bugs or issues here</a></p>
<p>Credit for some of the code and the original idea go to <a href="http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/">http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://g-Off.net/software/cllocation-forward-geolocation-method/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
