<?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>// do something here &#187; iPhone</title>
	<atom:link href="http://www.dosomethinghere.com/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dosomethinghere.com</link>
	<description>Turning impossibilities into 1s and 0s professionally since 0&#120;07C1</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:07:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>It&#8217;s &#8220;ordinal date&#8221;, actually&#8230;</title>
		<link>http://www.dosomethinghere.com/2012/01/11/its-ordinal-date-actually/</link>
		<comments>http://www.dosomethinghere.com/2012/01/11/its-ordinal-date-actually/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 21:14:59 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=879</guid>
		<description><![CDATA[I&#8217;m storing birthdays in Core Data, and now I want to get a list of entities sorted by the day of their birth. However, I just cannot sort by the date, since the year of their birth would take precedence, I just need to sort by the month and day of the NSDate stored as [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m storing birthdays in Core Data, and now I want to get a list of entities sorted by the day of their birth. However, I just cannot sort by the date, since the year of their birth would take precedence, I just need to sort by the month and day of the NSDate stored as the birth date.</p>
<p>The big problem that I faced was trying to find out how to get the Julian date from an NSDate. Well as it turns out, Julian date does not correctly describe what I was looking for, I needed to look for ordinal date.</p>
<p>After a bit of investigation, I was able to put together this category that I have hung off of NSDate in my app:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>ordinalDate
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSCalendar</span> currentCalendar<span style="color: #002200;">&#93;</span> ordinalityOfUnit<span style="color: #002200;">:</span>NSDayCalendarUnit 
             inUnit<span style="color: #002200;">:</span>NSYearCalendarUnit forDate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>This, along with a sortUsingComparator of my NSMutableArray of contacts, is exactly what the doctor ordered.</p>
<p>BTW, Happy Birthday to the Grand Canyon National Monument, created this day in 1908, which eventually became the Grand Canyon National Park. (Yet another must see place.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2012/01/11/its-ordinal-date-actually/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Renaming a Core Data attribute when creating a new model version</title>
		<link>http://www.dosomethinghere.com/2012/01/04/renaming-a-core-data-attribute-when-creating-a-new-model-version/</link>
		<comments>http://www.dosomethinghere.com/2012/01/04/renaming-a-core-data-attribute-when-creating-a-new-model-version/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 18:52:20 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=876</guid>
		<description><![CDATA[I found this one out the hard way. If you are doing simple attribute additions when you transition from one Core Data model version to another, you can just create a new model version, set your overall data model&#8217;s default to the new version, and add the needed attributes to the entities as you need. [...]]]></description>
			<content:encoded><![CDATA[<p>I found this one out the hard way.</p>
<p>If you are doing simple attribute additions when you transition from one Core Data model version to another, you can just create a new model version, set your overall data model&#8217;s default to the new version, and add the needed attributes to the entities as you need. When you fire up the app, the new fields are magically added to the table without any additional work.</p>
<p>However, when you want to rename an attribute, if you follow the above series of steps, the data that exists in the fields corresponding to the old attribute name is now replaced with a shiny new nil. Outstanding!</p>
<p>I guess I didn&#8217;t read the Apple Core Data docs well enough. Make sure that, when you add your model version and rename the attribute, make sure that you can see the Utilities view on the right side of the Xcode 4 window, click on the attribute you are renaming, click on the Data Model inspector (the third icon in the Utilities view, looks like a little database cylinder with an eye patch on it), and for the Renaming ID entry, type in the old name of the attribute. Once you do this, the data in the field should migrate forward.</p>
<p>Luckily, I didn&#8217;t blow away too many beta user&#8217;s data discovering this one.</p>
<p>BTW, a posthumous Happy Birthday to James Bond, the ornithologist whose book Ian Fleming had on his bookshelf and reportedly named his super spy character after.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2012/01/04/renaming-a-core-data-attribute-when-creating-a-new-model-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIButtonTypeInfoLight masquerading as a UIBarButtonItem</title>
		<link>http://www.dosomethinghere.com/2011/11/28/uibuttontypeinfolight-masquerading-as-a-uibarbuttonitem/</link>
		<comments>http://www.dosomethinghere.com/2011/11/28/uibuttontypeinfolight-masquerading-as-a-uibarbuttonitem/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 15:31:06 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=868</guid>
		<description><![CDATA[Just in case you were wondering how to use a UIButtonTypeInfoLight (or UIButtonTypeInfoDark) as a UINavigationItem (a la UIBarButtonItem), here is what I threw together. Put this code in your view controller&#8217;s viewDidLoad method: UIButton *button1 = &#91;UIButton buttonWithType:UIButtonTypeInfoLight&#93;; button1.frame = CGRectMake&#40;0.0f, 0.0f, 40.0f, 32.0f&#41;; &#91;button1 addTarget:self action:@selector&#40;aboutButtonPressed:&#41; forControlEvents:UIControlEventTouchUpInside&#93;; UIBarButtonItem *aboutButton = &#91;&#91;UIBarButtonItem alloc&#93; initWithCustomView:button1&#93;; [...]]]></description>
			<content:encoded><![CDATA[<p>Just in case you were wondering how to use a UIButtonTypeInfoLight (or UIButtonTypeInfoDark) as a UINavigationItem (a la UIBarButtonItem), here is what I threw together. Put this code in your view controller&#8217;s viewDidLoad method:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">UIButton <span style="color: #002200;">*</span>button1 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIButton buttonWithType<span style="color: #002200;">:</span>UIButtonTypeInfoLight<span style="color: #002200;">&#93;</span>;
button1.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>0.0f, 0.0f, 40.0f, 32.0f<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#91;</span>button1 addTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>aboutButtonPressed<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> forControlEvents<span style="color: #002200;">:</span>UIControlEventTouchUpInside<span style="color: #002200;">&#93;</span>;
UIBarButtonItem <span style="color: #002200;">*</span>aboutButton <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIBarButtonItem alloc<span style="color: #002200;">&#93;</span> initWithCustomView<span style="color: #002200;">:</span>button1<span style="color: #002200;">&#93;</span>;
self.navigationItem.leftBarButtonItem <span style="color: #002200;">=</span> aboutButton;
<span style="color: #002200;">&#91;</span>aboutButton release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Adjust the frame to your taste, and supply the aboutButtonPressed method with an (id)sender parameter, and you are good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/11/28/uibuttontypeinfolight-masquerading-as-a-uibarbuttonitem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Source iOS Projects (CIDUG meeting, November 22, 2011)</title>
		<link>http://www.dosomethinghere.com/2011/11/23/open-source-ios-projects-cidug-meeting-november-22-2011/</link>
		<comments>http://www.dosomethinghere.com/2011/11/23/open-source-ios-projects-cidug-meeting-november-22-2011/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 16:42:20 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CIDUG]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=865</guid>
		<description><![CDATA[Thanks to everyone who turned out on Tuesday night for my CIDUG presentation on utilizing open source iOS projects. The presentation went a bit longer than I was hoping, largely due to the volume of demos that I had. If you would like to download a PDF of the presentation, here is a link: Open [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who turned out on Tuesday night for my CIDUG presentation on utilizing open source iOS projects. The presentation went a bit longer than I was hoping, largely due to the volume of demos that I had.</p>
<p>If you would like to download a PDF of the presentation, here is a link:</p>
<p><a title="Open Source iOS Projects presentation" href="http://www.dosomethinghere.com/downloads/Open_Source_iOS_Projects_presentation.pdf" target="_blank">Open Source iOS Projects presentation</a></p>
<p>Also, if you would like to download a ZIP file of all of the demos that I did, here is a link for that:</p>
<p><a title="Open Source iOS Projects demos" href="http://www.dosomethinghere.com/downloads/Open_Source_iOS_Projects_demos.zip" target="_blank">Open Source iOS Projects demos</a></p>
<p>I realized this morning that what I should have done was to create a workspace, and then drag all of the individual projects into that one workspace for the demo. I have done this in the code that I uploaded, so when you unzip the demos file, just open the <strong>Demo projects.workspace</strong> file and then just use the Scheme selector at the top of the Xcode window to select which demo you want to look at or try out.</p>
<p>Please let me know if you have any questions or suggestions on the presentation or the demo code. I hope everyone out there has a safe and happy holiday season.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/11/23/open-source-ios-projects-cidug-meeting-november-22-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Details</title>
		<link>http://www.dosomethinghere.com/2011/11/11/details/</link>
		<comments>http://www.dosomethinghere.com/2011/11/11/details/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 21:01:31 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Spinal Tap moment]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Spinal Tap]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=861</guid>
		<description><![CDATA[It has been a while since I have made a post, so I figured I would take this opportunity to point out that, if you are ever putting together a UITableViewCell (such as in the cellForRowAtIndexPath delegate method), there is a big difference between this: cell.backgroundColor = &#91;UIColor redColor&#93;; And this: cell.contentView.backgroundColor = &#91;UIColor redColor&#93;; [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I have made a post, so I figured I would take this opportunity to point out that, if you are ever putting together a UITableViewCell (such as in the cellForRowAtIndexPath delegate method), there is a big difference between this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">cell.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor redColor<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>And this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">cell.contentView.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor redColor<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Or, if you are creating an NSSortDescriptor, there is a big difference between this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">sortDesc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSSortDescriptor</span> alloc<span style="color: #002200;">&#93;</span> initWithKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;sortOrder&quot;</span> ascending<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>And this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">sortDesc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSSortDescriptor</span> alloc<span style="color: #002200;">&#93;</span> initWithKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;sortOrder&quot;</span> ascending<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span>
                selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>localizedCaseInsensitiveCompare<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Happy Nigel Tufnel day and Last Binary Day Of This Century (11/11/11) to everyone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/11/11/details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing Relationships With App Users (CIDUG meeting, October 25, 2011)</title>
		<link>http://www.dosomethinghere.com/2011/10/25/managing-relationships-with-app-users-cidug-meeting-october-25-2011/</link>
		<comments>http://www.dosomethinghere.com/2011/10/25/managing-relationships-with-app-users-cidug-meeting-october-25-2011/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 02:30:49 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CIDUG]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=858</guid>
		<description><![CDATA[Ran Flasterstein gave a presentation tonight about his experiences in communicating with users of his apps. He mainly spoke about the ways that he encourages conversation with his users through feedback and e-mail. Next month at the CIDUG meeting, I will be giving my presentation, Open Source iOS Projects. Hopefully, since the meeting date is [...]]]></description>
			<content:encoded><![CDATA[<p>Ran Flasterstein gave a presentation tonight about his experiences in communicating with users of his apps. He mainly spoke about the ways that he encourages conversation with his users through feedback and e-mail.</p>
<p>Next month at the CIDUG meeting, I will be giving my presentation, Open Source iOS Projects. Hopefully, since the meeting date is only a couple of days before Thanksgiving, there will be fewer folks there for me to inflict my wit and wisdom on.</p>
<p>BTW, happy birthday to the pride of Kelvington, Wendel Clark. In my humble opinion, they should not even bother giving any other Leaf the C.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/10/25/managing-relationships-with-app-users-cidug-meeting-october-25-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paradise lost?</title>
		<link>http://www.dosomethinghere.com/2011/10/14/paradise-lost/</link>
		<comments>http://www.dosomethinghere.com/2011/10/14/paradise-lost/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 14:16:36 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=855</guid>
		<description><![CDATA[A couple of years ago, I wrote a blog post about displaying and dismissing a view controller in an iPhone application. To get rid of your view controller from within that view controller, you would simply run this line of code: &#91;&#91;self parentViewController&#93; dismissModalViewControllerAnimated:YES&#93;; Alas, with the update to iOS SDK version 5, this no [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago, I wrote a blog post about displaying and dismissing a view controller in an iPhone application. To get rid of your view controller from within that view controller, you would simply run this line of code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>self parentViewController<span style="color: #002200;">&#93;</span> dismissModalViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Alas, with the update to iOS SDK version 5, this no longer works. And in fact, if you spelunk through the UIViewController.h file, it does say that as of 5.0, it will no longer return the presenting view controller.</p>
<p>Luckily, you can just do this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span>self dismissModalViewControllerAnimated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>BTW, happy birthday to Roger Moore, star of the excellent films &#8220;The Cannonball Run&#8221; and &#8220;ffolkes&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/10/14/paradise-lost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make random entries into the iPhone address book</title>
		<link>http://www.dosomethinghere.com/2011/09/02/how-to-make-random-entries-into-the-iphone-address-book/</link>
		<comments>http://www.dosomethinghere.com/2011/09/02/how-to-make-random-entries-into-the-iphone-address-book/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 13:48:06 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=839</guid>
		<description><![CDATA[Are you a frustrated iOS developer working on an app that has to access the built-in address book on the device? Frustrated because you can&#8217;t find sample data to populate the address book in your Simulator, and you are too busy to create a bunch of test data? Well, for a limited time* only, we [...]]]></description>
			<content:encoded><![CDATA[<p>Are you a frustrated iOS developer working on an app that has to access the built-in address book on the device? Frustrated because you can&#8217;t find sample data to populate the address book in your Simulator, and you are too busy to create a bunch of test data?</p>
<p>Well, for a limited time* only, we at the Do Something Here Labs have a deal for you. For just a minimal** postage and handling charge, you too can use this sample code below to create random entries to your hearts content in your very own iOS app.</p>
<p>Here is the code in question. Simply drop this method into your Objective-C source code and call it in your app, and you will soon have contacts, contacts, and more contacts.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;AddressBook/AddressBook.h&gt;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>addressBookData
<span style="color: #002200;">&#123;</span>
<span style="color: #6e371a;">#define NUMBER_OF_RANDOM_ENTRIES    25</span>
<span style="color: #6e371a;">#define GENDER_OF_NAMES             @&quot;m&quot;    // use m for male or f for female</span>
<span style="color: #6e371a;">#define URL_FORMAT  @&quot;http://old.wave39.com/roster/generate.php?f=csv&amp;g=%@&amp;num=%d&amp;limit=99&quot;</span>
&nbsp;
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>urlString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span>URL_FORMAT, GENDER_OF_NAMES, NUMBER_OF_RANDOM_ENTRIES<span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span>urlString<span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSURLRequest</span> <span style="color: #002200;">*</span>urlRequest <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLRequest</span> requestWithURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSURLResponse</span> <span style="color: #002200;">*</span>response <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span>error <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span>data <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLConnection</span> sendSynchronousRequest<span style="color: #002200;">:</span>urlRequest returningResponse<span style="color: #002200;">:&amp;</span>response error<span style="color: #002200;">:&amp;</span>error<span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>stringData <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithUTF8String<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>data bytes<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>areaCode <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%03d&quot;</span>, <span style="color: #002200;">&#40;</span>arc4random<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">799</span> <span style="color: #002200;">+</span> <span style="color: #2400d9;">200</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>lineArray <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>stringData componentsSeparatedByString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;<span style="color: #2400d9;">\n</span>&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>line <span style="color: #a61390;">in</span> lineArray<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>line length<span style="color: #002200;">&#93;</span> &gt; <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#123;</span>
            <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>fieldArray <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>line componentsSeparatedByString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;,&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>fieldArray count<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> <span style="color: #2400d9;">3</span><span style="color: #002200;">&#41;</span>
            <span style="color: #002200;">&#123;</span>
                ABAddressBookRef addressBook <span style="color: #002200;">=</span> ABAddressBookCreate<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>; 
                ABRecordRef person <span style="color: #002200;">=</span> ABPersonCreate<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
                <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>phone <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@-%03d-%04d&quot;</span>, areaCode,
                                   <span style="color: #002200;">&#40;</span>arc4random<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">799</span> <span style="color: #002200;">+</span> <span style="color: #2400d9;">200</span><span style="color: #002200;">&#41;</span>, <span style="color: #002200;">&#40;</span>arc4random<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">9999</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;   
                ABMutableMultiValueRef phoneNumberMultiValue <span style="color: #002200;">=</span> ABMultiValueCreateMutable<span style="color: #002200;">&#40;</span>kABPersonPhoneProperty<span style="color: #002200;">&#41;</span>;
                CFStringRef phoneType <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>arc4random<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">%</span> <span style="color: #2400d9;">2</span> <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span> ? kABPersonPhoneMainLabel <span style="color: #002200;">:</span> kABPersonPhoneMobileLabel<span style="color: #002200;">&#41;</span>;
                ABMultiValueAddValueAndLabel<span style="color: #002200;">&#40;</span>phoneNumberMultiValue, phone, phoneType, <span style="color: #a61390;">NULL</span><span style="color: #002200;">&#41;</span>;
                ABRecordSetValue<span style="color: #002200;">&#40;</span>person, kABPersonFirstNameProperty, <span style="color: #002200;">&#91;</span>fieldArray objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>;
                ABRecordSetValue<span style="color: #002200;">&#40;</span>person, kABPersonLastNameProperty, <span style="color: #002200;">&#91;</span>fieldArray objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>;
                ABRecordSetValue<span style="color: #002200;">&#40;</span>person, kABPersonPhoneProperty, phoneNumberMultiValue, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>;
                ABAddressBookAddRecord<span style="color: #002200;">&#40;</span>addressBook, person, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>;
                ABAddressBookSave<span style="color: #002200;">&#40;</span>addressBook, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>;
                NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Created record for %@ %@ (%@: %@)&quot;</span>, <span style="color: #002200;">&#91;</span>fieldArray objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>, 
                      <span style="color: #002200;">&#91;</span>fieldArray objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span>, phoneType, phone<span style="color: #002200;">&#41;</span>;
                CFRelease<span style="color: #002200;">&#40;</span>phoneNumberMultiValue<span style="color: #002200;">&#41;</span>;
                CFRelease<span style="color: #002200;">&#40;</span>person<span style="color: #002200;">&#41;</span>;
                CFRelease<span style="color: #002200;">&#40;</span>addressBook<span style="color: #002200;">&#41;</span>;
            <span style="color: #002200;">&#125;</span>
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
&nbsp;
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Done creating address book data.&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>On a housekeeping note, make sure to include the AddressBook.framework library in your application, and make sure to import the AddressBook.h header file as shown. Although if you are already developing an app that accesses the address book, you probably have this covered.</p>
<p>Also, your device or computer needs to have internet access while the code is running, as the code accesses a simple PHP application that I did a while back to do random sports roster generation. (The PHP application will generate a maximum of 99 entries at a time, so if you want to try and have it generate 42 billion names with one call, go right on ahead and try.) OK, I probably should not be blocking the main thread with the synchronous request, but I did not have time do something other than the most quick and dirty solution possible.</p>
<p>But wait, there&#8217;s more.</p>
<p>Happy birthday to Terry Bradshaw. I&#8217;m sure that if Terry was developing an iOS app, and he needed to populate some random address book entries, this would be the code he would use. And if it is good enough for Terry, isn&#8217;t it good enough for everyone?</p>
<p>(* = For as long as this web site is accessible on the internet)</p>
<p>(** = $0.00)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/09/02/how-to-make-random-entries-into-the-iphone-address-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batter vs. Pitcher Lite now available</title>
		<link>http://www.dosomethinghere.com/2011/09/01/batter-vs-pitcher-lite-now-available/</link>
		<comments>http://www.dosomethinghere.com/2011/09/01/batter-vs-pitcher-lite-now-available/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 15:38:12 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=837</guid>
		<description><![CDATA[Maybe someone at Apple was reading my blog yesterday, because a couple of hours after I posted my lamentations over the BvP Lite approval wait, the app went into the approval process and was approved then an hour or so after that. Awesome job Apple, thanks. Here is the link to the Batter vs. Pitcher [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe someone at Apple was reading my blog yesterday, because a couple of hours after I posted my lamentations over the BvP Lite approval wait, the app went into the approval process and was approved then an hour or so after that. Awesome job Apple, thanks.</p>
<p>Here is the link to the Batter vs. Pitcher Lite free app:</p>
<p><a href="http://itunes.apple.com/app/batter-vs.-pitcher-lite/id459881743?mt=8" target="_blank">Batter vs. Pitcher Lite</a></p>
<p>And if you need to be able to analyze more than one batter and/or pitcher at a time, you would need to get the non-free Batter vs. Pitcher app:</p>
<p><a href="http://itunes.apple.com/app/batter-vs.-pitcher/id445287806?mt=8" target="_blank">Batter vs. Pitcher</a></p>
<p>No birthday, anniversary, or holiday wishes at this time, but I would like to say that I am totally impressed with my new 13&#8243; MacBook Air. It seems to be more than adequate for building iOS apps, and due to the SSD drive, it actually seems to compile, build, and fire up the simulator much faster than my old MacBook Pro.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/09/01/batter-vs-pitcher-lite-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Still patiently waiting</title>
		<link>http://www.dosomethinghere.com/2011/08/31/still-patiently-waiting/</link>
		<comments>http://www.dosomethinghere.com/2011/08/31/still-patiently-waiting/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 20:21:37 +0000</pubDate>
		<dc:creator>BP</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://www.dosomethinghere.com/?p=834</guid>
		<description><![CDATA[Well, I took the version 1.0 BvP app and turned this 1 batter vs. 1 pitcher app into a free app, and submitted this new app to iTunes Connect. They seem to be dragging their feet on this new app, as it has been over a week. App revisions seem to go much faster, it [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I took the version 1.0 BvP app and turned this 1 batter vs. 1 pitcher app into a free app, and submitted this new app to iTunes Connect. They seem to be dragging their feet on this new app, as it has been over a week. App revisions seem to go much faster, it only took a few days when I submitted the 2.0 BvP app, which features the ability to have multiple pitchers vs. multiple batters. This is a much more useful mode for fantasy baseball or for statistical research.</p>
<p>BTW, Happy Birthday to John Boker. (Not the John Boker who played baseball for the Ogden Raptors, but &#8220;the&#8221; John Boker who was formerly a track star and also happens to be Ohio&#8217;s pre-eminent bacon tea connoisseur.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dosomethinghere.com/2011/08/31/still-patiently-waiting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

