<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Wed, 30 May 2012 20:42:59 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Matt Wanninger | Programming &amp; Gaming</title><link>http://mattwanninger.com/blog/</link><description></description><lastBuildDate>Sat, 28 Apr 2012 21:58:17 +0000</lastBuildDate><copyright></copyright><language>en-US</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>iOS Programming: Why I'm Using Your Location</title><category>Programming</category><dc:creator>Matt Wanninger</dc:creator><pubDate>Sat, 28 Apr 2012 06:24:53 +0000</pubDate><link>http://mattwanninger.com/blog/2012/4/28/ios-programming-why-im-using-your-location.html</link><guid isPermaLink="false">477350:5408559:16036254</guid><description><![CDATA[<p>Almost everyone who owns an iPhone has come across an app that uses location services, usually indicated by a pop-up like this:</p>
<p style="text-align: center;"><span class="full-image-block ssNonEditable"><span><img style="width: 400px;" src="http://mattwanninger.com/storage/location.png?__SQUARESPACE_CACHEVERSION=1335650291416" alt="" /></span></span></p>
<p>I know I can sometimes be hesitant to tap "OK" unless it's for something I can immediately see the reason for why the app would want access to my location (Google Maps, for example). Luckily, there is a way to offer an explanation to the user as to why you are requesting their location.</p>
<p>CLLocationManager has a property called <em>purpose</em>, which is just an NSString that gets displayed as message text between the "[AppName] would like to use your current location" text and the "OK"/"Don't Allow" buttons. Set this property to an appropriate message describing to the user why you'd like to get their location (find nearby restaurants, give directions, etc.) so they don't worry their location is being used inappropriately:</p>
<blockquote>
<p class="p1"><strong>locationManager.purpose = @"This app uses location information to determine the nearest points of interest for your hike.";</strong></p>
</blockquote>
<p>Note that the <em>purpose</em>&nbsp;property must be set before starting location services (startUpdatingLocation).</p>
<p>The end result:</p>
<p style="text-align: center;"><span class="full-image-block ssNonEditable"><span><img style="width: 400px;" src="http://mattwanninger.com/storage/purpose.png?__SQUARESPACE_CACHEVERSION=1335650282188" alt="" /></span></span></p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: left;"><em>Special thanks to Carl Brown for this tip from his CocoaCoder.org meetup presentation. His website is <a href="http://www.escortmissions.com/" target="_blank">http://www.escortmissions.com/</a>.</em></p>]]></description><wfw:commentRss>http://mattwanninger.com/blog/rss-comments-entry-16036254.xml</wfw:commentRss></item></channel></rss>
