<?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>petersteinberger.com &#187; ObjectiveC</title>
	<atom:link href="http://petersteinberger.com/category/coding/objectivec/feed/" rel="self" type="application/rss+xml" />
	<link>http://petersteinberger.com</link>
	<description>bits about life, coding and stuff</description>
	<lastBuildDate>Thu, 09 Sep 2010 13:41:36 +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>Custom Formatter for the cocoalumberjack logging framework</title>
		<link>http://petersteinberger.com/2010/09/custom-formatter-for-the-cocoalumberjack-logging-framework/</link>
		<comments>http://petersteinberger.com/2010/09/custom-formatter-for-the-cocoalumberjack-logging-framework/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 13:41:36 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=1029</guid>
		<description><![CDATA[Want awesomely fast and flexible logging in your iOS/Cocoa apps? Don&#8217;t use NSLog! Use cocoalumberjack. I&#8217;ve written an custom formatter to make it even more awesome. It will give you output like this: [CC] 2010-09-09 15:38:58:125(207) [AppDelegate application:didFinishLaunchingWithOptions:/59] app is starting up&#8230; [/CC] Look again. You get: Log Level (Info is omitted, can be Verbose, Warn, [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/09/better-logging-for-ios-and-mac-cocoalumberjack/' rel='bookmark' title='Permanent Link: Better logging for iOS and Mac: cocoalumberjack'>Better logging for iOS and Mac: cocoalumberjack</a></li>
<li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/10/iphone-gaming-framework/' rel='bookmark' title='Permanent Link: iPhone gaming framework'>iPhone gaming framework</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Want awesomely fast and flexible logging in your iOS/Cocoa apps? Don&#8217;t use NSLog! Use <a href="http://code.google.com/p/cocoalumberjack/" target="_blank" class="liexternal">cocoalumberjack</a>.</p>
<p>I&#8217;ve written an custom formatter to make it even more awesome. It will give you output like this:</p>
<p>[CC]</p>
<p>2010-09-09 15:38:58:125(207) [AppDelegate application:didFinishLaunchingWithOptions:/59] app is starting up&#8230;</p>
<p>[/CC]</p>
<p>Look again. You get:</p>
<ul>
<li>Log Level (Info is omitted, can be Verbose, Warn, Error)</li>
<li>Exact Timestamp</li>
<li>Thread ID</li>
<li>Class</li>
<li>Function Name</li>
<li>Line Number (wooot!)</li>
<li>Message</li>
</ul>
<p>Have fun!</p>
<p><script src="http://gist.github.com/571860.js"> </script></p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/09/better-logging-for-ios-and-mac-cocoalumberjack/' rel='bookmark' title='Permanent Link: Better logging for iOS and Mac: cocoalumberjack'>Better logging for iOS and Mac: cocoalumberjack</a></li>
<li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/10/iphone-gaming-framework/' rel='bookmark' title='Permanent Link: iPhone gaming framework'>iPhone gaming framework</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/09/custom-formatter-for-the-cocoalumberjack-logging-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[NSString description] via reflection</title>
		<link>http://petersteinberger.com/2010/09/nsstring-description-via-reflection/</link>
		<comments>http://petersteinberger.com/2010/09/nsstring-description-via-reflection/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 10:14:00 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=1023</guid>
		<description><![CDATA[Bored of coding all those description funtions for your model? Well, at least I am, and instead of writing all those erroneous NSString stringWithFormat calls to get decent debug infos, I used this categories: (Well, that&#8217;s not all.. you still need to either code [description] or make another category for it. I didn&#8217;t want to [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/' rel='bookmark' title='Permanent Link: NSDateFormatter and +00:00 parsing'>NSDateFormatter and +00:00 parsing</a></li>
<li><a href='http://petersteinberger.com/2010/03/detect-if-an-iphone-is-jailbroken/' rel='bookmark' title='Permanent Link: Detect if an iPhone is jailbroken'>Detect if an iPhone is jailbroken</a></li>
<li><a href='http://petersteinberger.com/2010/02/namespaces-and-objectivec/' rel='bookmark' title='Permanent Link: Namespaces and ObjectiveC'>Namespaces and ObjectiveC</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Bored of coding all those description funtions for your model? Well, at least I am, and instead of writing all those erroneous NSString stringWithFormat calls to get decent debug infos, I used this categories:</p>
<p>(Well, that&#8217;s not all.. you still need to either code [description] or make another category for it. I didn&#8217;t want to override base NSObject, so I just use it for NSManagedObject)</p>
<p><a href="http://petersteinberger.com/wp-content/uploads/2010/09/NSObject+AutoDescription.h.zip" class="lizip">Download NSObject+AutoDescription</a></p>
<p>NSObject+AutoDescription.h<br />
[CC]<br />
// thanks to Kendall Helmstetter Geln<br />
// http://stackoverflow.com/questions/2299841/objective-c-introspection-reflection<br />
@interface NSObject (AutoDescription)</p>
<p>+ (NSString *) autoDescribe:(id)instance classType:(Class)classType;<br />
+ (NSString *) autoDescribe:(id)instance;</p>
<p>@end<br />
[/CC]</p>
<p>NSObject+AutoDescription.m<br />
[CC]<br />
#import &#8220;NSObject+AutoDescription.h&#8221;</p>
<p>@implementation NSObject(AutoDescription)</p>
<p>// Finds all properties of an object, and prints each one out as part of a string describing the class.<br />
+ (NSString *) autoDescribe:(id)instance classType:(Class)classType<br />
{<br />
  NSUInteger count;<br />
  objc_property_t *propList = class_copyPropertyList(classType, &#038;count);<br />
  NSMutableString *propPrint = [NSMutableString string];</p>
<p>  for ( int i = 0; i < count; i++ )<br />
  {<br />
    objc_property_t property = propList[i];</p>
<p>    const char *propName = property_getName(property);<br />
    NSString *propNameString =[NSString stringWithCString:propName encoding:NSASCIIStringEncoding];</p>
<p>    if(propName)<br />
    {<br />
      id value = [instance valueForKey:propNameString];<br />
      [propPrint appendString:[NSString stringWithFormat:@"%@=%@ ; ", propNameString, value]];<br />
    }<br />
  }<br />
  free(propList);</p>
<p>  // Now see if we need to map any superclasses as well.<br />
  Class superClass = class_getSuperclass( classType );<br />
  if ( superClass != nil &#038;&#038; ! [superClass isEqual:[NSObject class]] )<br />
  {<br />
    NSString *superString = [self autoDescribe:instance classType:superClass];<br />
    [propPrint appendString:superString];<br />
  }</p>
<p>  return propPrint;<br />
}</p>
<p>+ (NSString *) autoDescribe:(id)instance<br />
{<br />
  NSString *headerString = [NSString stringWithFormat:@"%@:%p:: ",[instance class], instance];<br />
  return [headerString stringByAppendingString:[self autoDescribe:instance classType:[instance class]]];<br />
}</p>
<p>@end<br />
[/CC]</p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/' rel='bookmark' title='Permanent Link: NSDateFormatter and +00:00 parsing'>NSDateFormatter and +00:00 parsing</a></li>
<li><a href='http://petersteinberger.com/2010/03/detect-if-an-iphone-is-jailbroken/' rel='bookmark' title='Permanent Link: Detect if an iPhone is jailbroken'>Detect if an iPhone is jailbroken</a></li>
<li><a href='http://petersteinberger.com/2010/02/namespaces-and-objectivec/' rel='bookmark' title='Permanent Link: Namespaces and ObjectiveC'>Namespaces and ObjectiveC</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/09/nsstring-description-via-reflection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitHub is a Goldmine!</title>
		<link>http://petersteinberger.com/2010/09/github-is-a-goldmine/</link>
		<comments>http://petersteinberger.com/2010/09/github-is-a-goldmine/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 12:53:33 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=1019</guid>
		<description><![CDATA[Have I mentioned that Github is just awesome? And that there are so many gems hidden for us iOS-Developers? I always read my GitHub timeline and read Twitter to find new stuff. Today I stumbled on effectiveprogramming / ep-iphone &#8211; there are some really handy code snippets in the wiki section! Btw, you can follow [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/ipad-code-goldmine/' rel='bookmark' title='Permanent Link: iPad Code Goldmine'>iPad Code Goldmine</a></li>
<li><a href='http://petersteinberger.com/2010/01/how-to-mirror-an-svn-repository-on-github/' rel='bookmark' title='Permanent Link: How to Mirror an SVN repository on GitHub'>How to Mirror an SVN repository on GitHub</a></li>
<li><a href='http://petersteinberger.com/2010/04/this-weeks-links-6/' rel='bookmark' title='Permanent Link: This week&#8217;s links'>This week&#8217;s links</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Have I mentioned that Github is just awesome? And that there are so many gems hidden for us iOS-Developers? I always read my GitHub timeline and read Twitter to find new stuff. Today I stumbled on effectiveprogramming / ep-iphone &#8211; there are some really handy code snippets in the wiki section! Btw, you can <a href="http://github.com/steipete" target="_blank" class="liexternal">follow me</a> for a headstart!</p>
<p><a href="http://wiki.github.com/effectiveprogramming/ep-iphone/uitableviewcell" target="_blank" class="liexternal">http://wiki.github.com/effectiveprogramming/ep-iphone/uitableviewcell</a></p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/ipad-code-goldmine/' rel='bookmark' title='Permanent Link: iPad Code Goldmine'>iPad Code Goldmine</a></li>
<li><a href='http://petersteinberger.com/2010/01/how-to-mirror-an-svn-repository-on-github/' rel='bookmark' title='Permanent Link: How to Mirror an SVN repository on GitHub'>How to Mirror an SVN repository on GitHub</a></li>
<li><a href='http://petersteinberger.com/2010/04/this-weeks-links-6/' rel='bookmark' title='Permanent Link: This week&#8217;s links'>This week&#8217;s links</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/09/github-is-a-goldmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better logging for iOS and Mac: cocoalumberjack</title>
		<link>http://petersteinberger.com/2010/09/better-logging-for-ios-and-mac-cocoalumberjack/</link>
		<comments>http://petersteinberger.com/2010/09/better-logging-for-ios-and-mac-cocoalumberjack/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 23:53:40 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=1015</guid>
		<description><![CDATA[Everyone knows that NSLog sucks big times. In the past, i pointed to GTMLogger from the google-toolkit, which is very capable. But here I found the new gold-class in logging. Complete with writing to a file, web access and more. Get started (Goole Code Wiki) You might be thinking &#8220;logging is boring&#8221;. But what if [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/09/custom-formatter-for-the-cocoalumberjack-logging-framework/' rel='bookmark' title='Permanent Link: Custom Formatter for the cocoalumberjack logging framework'>Custom Formatter for the cocoalumberjack logging framework</a></li>
<li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/10/objective-c-operator-overloading/' rel='bookmark' title='Permanent Link: Objective C != Operator overloading'>Objective C != Operator overloading</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Everyone knows that NSLog sucks big times. In the past, i pointed to GTMLogger from the google-toolkit, which is very capable. But here I found the new gold-class in logging. Complete with writing to a file, web access and more. </p>
<p><a href="http://code.google.com/p/cocoalumberjack/wiki/GettingStarted" target="_blank" class="liexternal">Get started</a> (Goole Code Wiki)</p>
<blockquote><p>You might be thinking &#8220;logging is boring&#8221;.</p>
<p>But what if I told you that by using the framework you can actually make your application faster because it is an order of magnitude faster than NSLog?</p>
<p>What if I told you that the framework could allow you to debug your iPhone application remotely, by viewing its log statements in real time, via your web browser?</p></blockquote>
<p><a href="http://deusty.blogspot.com/2010/05/introducing-cocoa-lumberjack.html" target="_blank" class="liexternal">Introducing Cocoa Lumberjack</a></p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/09/custom-formatter-for-the-cocoalumberjack-logging-framework/' rel='bookmark' title='Permanent Link: Custom Formatter for the cocoalumberjack logging framework'>Custom Formatter for the cocoalumberjack logging framework</a></li>
<li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/10/objective-c-operator-overloading/' rel='bookmark' title='Permanent Link: Objective C != Operator overloading'>Objective C != Operator overloading</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/09/better-logging-for-ios-and-mac-cocoalumberjack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing NSFetchedResultsController</title>
		<link>http://petersteinberger.com/2010/09/fixing-nsfetchedresultscontroller/</link>
		<comments>http://petersteinberger.com/2010/09/fixing-nsfetchedresultscontroller/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 20:38:30 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=1010</guid>
		<description><![CDATA[I always had problems with NSFetchedResultsController and dynamic cell updates. I never was able to fix it, some really strange bugs were in there. I used to write some workarounds (like the crash when you tell UITableView to update a certain cell more than once&#8230; but in the end i always worked on the symptoms, [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/02/on-fixing-symbolicatecrash/' rel='bookmark' title='Permanent Link: on fixing symbolicatecrash'>on fixing symbolicatecrash</a></li>
<li><a href='http://petersteinberger.com/2010/06/the-facebook-app-situation/' rel='bookmark' title='Permanent Link: The Facebook-App Situation'>The Facebook-App Situation</a></li>
<li><a href='http://petersteinberger.com/2010/03/core-animation-crash-attempt-to-create-two-animations-for-cell/' rel='bookmark' title='Permanent Link: Core Animation Crash: Attempt to create two animations for cell'>Core Animation Crash: Attempt to create two animations for cell</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I always had problems with NSFetchedResultsController and dynamic cell updates. I never was able to fix it, some really strange bugs were in there. I used to write some workarounds (like the crash when you tell UITableView to update a certain cell more than once&#8230; but in the end i always worked on the symptoms, not the cause.</p>
<p><a href="http://deusty.blogspot.com/2010/02/more-bugs-in-nsfetchedresultscontroller.html" target="_blank" class="liexternal">Then i found THIS</a>.</p>
<p><strong>Somebody wrote a wrapper for NSFetchedResultsController called SafeFetchedResultsController</strong>, that fixes bugs that are there since it&#8217;s first release (tested on iOS 4.1). Apple has to be aware of this, but maybe they don&#8217;t fix it because it must certainly would break existing applications.</p>
<p>This wrapper is a direct replacement, it subclasses Apple&#8217;s class, carefully analyzes the update messages and fixes them if they are wrong. And guess what&#8230; it works! It&#8217;s so great to finally fix this issue and enable smooth animations instead of the brutal (but working) [tableView reloadData].</p>
<p>So if your app is crashing randomly with messages like &#8220;Exception was caught during Core Data change processing&#8221;, this one is for you.</p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/02/on-fixing-symbolicatecrash/' rel='bookmark' title='Permanent Link: on fixing symbolicatecrash'>on fixing symbolicatecrash</a></li>
<li><a href='http://petersteinberger.com/2010/06/the-facebook-app-situation/' rel='bookmark' title='Permanent Link: The Facebook-App Situation'>The Facebook-App Situation</a></li>
<li><a href='http://petersteinberger.com/2010/03/core-animation-crash-attempt-to-create-two-animations-for-cell/' rel='bookmark' title='Permanent Link: Core Animation Crash: Attempt to create two animations for cell'>Core Animation Crash: Attempt to create two animations for cell</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/09/fixing-nsfetchedresultscontroller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TTStyledText and ampersand (’&amp;&#8217;)</title>
		<link>http://petersteinberger.com/2010/06/ttstyledtext-and-ampersand-%e2%80%99/</link>
		<comments>http://petersteinberger.com/2010/06/ttstyledtext-and-ampersand-%e2%80%99/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 11:46:57 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=934</guid>
		<description><![CDATA[My styled text disappeared sometimes. I tracked down the problem. You&#8217;re not allowed to have bare ampersands in the styled text. Replace them with the html-encoded variant and everything works fine. [CC] // fix styled text for apersand problems styledText = [styledText stringByReplacingOccurrencesOfString:@"&#038;" withString:@"&#38;"]; [/CC] Other than that, TTStyledText is plain awesome, so is the [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/' rel='bookmark' title='Permanent Link: NSDateFormatter and +00:00 parsing'>NSDateFormatter and +00:00 parsing</a></li>
<li><a href='http://petersteinberger.com/2009/05/building-better-iphone-apps-with-three20/' rel='bookmark' title='Permanent Link: Building better iPhone apps with three20'>Building better iPhone apps with three20</a></li>
<li><a href='http://petersteinberger.com/2010/09/a-better-open-quickly-peepopen/' rel='bookmark' title='Permanent Link: A better Open Quickly: PeepOpen'>A better Open Quickly: PeepOpen</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>My styled text disappeared sometimes. I tracked down the problem. You&#8217;re not allowed to have bare ampersands in the styled text. Replace them with the html-encoded variant and everything works fine.</p>
<p>[CC]<br />
  // fix styled text for apersand problems<br />
  styledText = [styledText stringByReplacingOccurrencesOfString:@"&#038;" withString:@"&amp;"];<br />
[/CC]</p>
<p>Other than that, TTStyledText is plain awesome, so is the whole three2 framework (extracted from the facebook iPhone App)</p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/' rel='bookmark' title='Permanent Link: NSDateFormatter and +00:00 parsing'>NSDateFormatter and +00:00 parsing</a></li>
<li><a href='http://petersteinberger.com/2009/05/building-better-iphone-apps-with-three20/' rel='bookmark' title='Permanent Link: Building better iPhone apps with three20'>Building better iPhone apps with three20</a></li>
<li><a href='http://petersteinberger.com/2010/09/a-better-open-quickly-peepopen/' rel='bookmark' title='Permanent Link: A better Open Quickly: PeepOpen'>A better Open Quickly: PeepOpen</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/06/ttstyledtext-and-ampersand-%e2%80%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSDateFormatter and +00:00 parsing</title>
		<link>http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/</link>
		<comments>http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/#comments</comments>
		<pubDate>Mon, 17 May 2010 17:15:47 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=861</guid>
		<description><![CDATA[Just had a gotcha trying to compile one of my projects on OS4. NSDateFormatter refused to parse dates, just returned zero. After further investigation, the problem was an almost unnoticeable difference in the date format: 2010-05-17T19:08:11+02:00 But the unicode standard needs a +0200, thus NO Semicolon. NSDateFormatter for 10.5 and OS3 just silently quit parsing, and [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2009/07/demystifiying-rails-model-attributes-overriding/' rel='bookmark' title='Permanent Link: Demystifiying Rails Model attributes overriding'>Demystifiying Rails Model attributes overriding</a></li>
<li><a href='http://petersteinberger.com/2009/04/howto-update-rake-081-084-on-debian/' rel='bookmark' title='Permanent Link: HowTo update rake 0.8.1 -> 0.8.4 on debian'>HowTo update rake 0.8.1 -> 0.8.4 on debian</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Just had a gotcha trying to compile one of my projects on OS4. NSDateFormatter refused to parse dates, just returned zero.</p>
<p>After further investigation, the problem was an almost unnoticeable difference in the date format:</p>
<p>2010-05-17T19:08:11+02<strong>:</strong>00<br />
But the unicode standard needs a +0200, thus <strong>NO Semicolon</strong>.<br />
NSDateFormatter for 10.5 and OS3 just silently quit parsing, and because he then assumed 00 nobody noticed.<br />
The behaviour on 10.6 and OS4 changed to be totally strict now.</p>
<blockquote><p>Prior to Mac OS 10.6, both NSNumberFormatter&#8217;s and NSDateFormatter&#8217;s implementation of -getObjectValue:forString:errorDescription: would return YES and a parsed object value if only part of the string could be parsed. This is problematic because with this API you cannot be sure what portion of the string was parsed. For applications linked on or after Mac OS 10.6, this <strong>method instead returns an error </strong>if part of the string cannot be parsed. You can use -getObjectValue:forString:range:error: to get the old behavior; this method returns the range of the substring that was successfully parsed.</p></blockquote>
<p>See this code example. The &#8220;fix&#8221; is code line nr.2 (stringByReplacingOccurrencesOfString)<br />
That&#8217;s not a perfect solution, it won&#8217;t work in wanky half-hour timezones, but i don&#8217;t need to parse such data.</p>
<p>Another solution would be a) using the old parse method (getObjectValue:forString:range:error) or use an NSMutableString to search for the last semicolon to purge.</p>
<p>Note the testDebugStr, that&#8217;s the best solution to debug Date Formatters. (so obvious&#8230;)</p>
<p>[CC lang="objc"]<br />
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];<br />
[dateFormatter setTimeStyle:NSDateFormatterFullStyle];<br />
dateFormatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@&#8221;en_US&#8221;] autorelease];<br />
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];</p>
<p>NSString *dateStr = [[entry objectForKey:@"published"] objectForXMLNode];<br />
// we need to strip out the single colon<br />
dateStr = [dateStr stringByReplacingOccurrencesOfString:@":00" withString:@"00"];<br />
NSString *testDebugStr = [dateFormatter stringFromDate:[NSDate date]];<br />
NSDate* date = [dateFormatter dateFromString:dateStr];<br />
GTMLoggerInfo(@&#8221;%@ %@ %@&#8221;, testDebugStr, dateStr, [date description]);<br />
[/CC]</p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2009/07/demystifiying-rails-model-attributes-overriding/' rel='bookmark' title='Permanent Link: Demystifiying Rails Model attributes overriding'>Demystifiying Rails Model attributes overriding</a></li>
<li><a href='http://petersteinberger.com/2009/04/howto-update-rake-081-084-on-debian/' rel='bookmark' title='Permanent Link: HowTo update rake 0.8.1 -> 0.8.4 on debian'>HowTo update rake 0.8.1 -> 0.8.4 on debian</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/05/nsdateformatter-and-0000-parsing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPad Code Goldmine</title>
		<link>http://petersteinberger.com/2010/05/ipad-code-goldmine/</link>
		<comments>http://petersteinberger.com/2010/05/ipad-code-goldmine/#comments</comments>
		<pubDate>Sat, 08 May 2010 16:37:03 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=854</guid>
		<description><![CDATA[OmniGroup has released some nifty stuff. OmniUI/iPad: - First release of this framework! - Includes a bunch of features from our iPad apps - Document picker, basic document-based application support - CoreText-based text editor (still a work in progress, but a great start) - We&#8217;ll be working more on performance for large blobs of text, [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/04/dashboard-for-ipad-opensourced/' rel='bookmark' title='Permanent Link: Dashboard for iPad opensourced'>Dashboard for iPad opensourced</a></li>
<li><a href='http://petersteinberger.com/2010/03/fiddling-with-reachability-code/' rel='bookmark' title='Permanent Link: Fiddling with Reachability code?'>Fiddling with Reachability code?</a></li>
<li><a href='http://petersteinberger.com/2009/10/the-omni-groups-frameworks/' rel='bookmark' title='Permanent Link: The Omni Group&#8217;s frameworks'>The Omni Group&#8217;s frameworks</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>OmniGroup has released <a href="http://github.com/omnigroup/OmniGroup/commit/f7d10116f472aa51c20bb47efa82f5cf0c8cdaf8" target="_blank" class="liexternal">some nifty stuff</a>.</p>
<p>OmniUI/iPad:<br />
- First release of this framework!<br />
- Includes a bunch of features from our iPad apps<br />
- Document picker, basic document-based application support<br />
- CoreText-based text editor (still a work in progress, but a great start)<br />
- We&#8217;ll be working more on performance for large blobs of text, which we<br />
haven&#8217;t needed yet.<br />
- Zooming/tiling scroll view system<br />
- Extensible inspector system; includes full font and color inspectors<br />
(palette, hsv, rgb, gray)<br />
- widgets (thumb wheel, color swatches, toggle buttons, matching segmented<br />
control, editable text well)<br />
- Support for sending feedback, exporting documents/PDF via Mail,<br />
documentation, etc.<br />
- See examples in OmniGroup/Frameworks/OmniUI/iPad/Examples<br />
- The text editor example is still in progress, but isn&#8217;t fully hooked up<br />
yet (no inspectors yet)<br />
- Gesture recognizer debugging helper (logs all events and state changes)<br />
- &#8220;Direct&#8221; tap recognizer subclass<br />
- Overlay hint view (for example, showing the % zoom level while in the middle<br />
of a zoom gesture).<br />
- Basic RTF reading/writing</p>
<p>OmniQuartz:<br />
- First release of this framework!<br />
- Includes a subset as a static library OmniQuartzTouch target for iPhone OS.<br />
- Includes lots of CALayer debugging support, helpers (log all animations,<br />
logging of layer trees, vector output for layer trees)<br />
- Includes some basic drawing routings for<br />
- Includes some simple CoreImage utilities<br />
- Includes a class cluster of color component preserving color classes.<br />
UIColor is more &#8220;build-only&#8221;. OQColor remembers the components you gave it and<br />
acts more like a model object (including XML and plist archiving support based<br />
on NSColor(OAExtensions)).<br />
- Includes delayed layer removal animations (since removing a layer normally<br />
is instantaneous in CA unless you want default animation).<br />
- Includes a (perspective correct) view transition flip animation<br />
- Includes a &#8216;hole&#8217; layer.</p>
<p><a href="http://github.com/omnigroup/OmniGroup" target="_blank" class="liexternal">Go clone it!</a></p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/04/dashboard-for-ipad-opensourced/' rel='bookmark' title='Permanent Link: Dashboard for iPad opensourced'>Dashboard for iPad opensourced</a></li>
<li><a href='http://petersteinberger.com/2010/03/fiddling-with-reachability-code/' rel='bookmark' title='Permanent Link: Fiddling with Reachability code?'>Fiddling with Reachability code?</a></li>
<li><a href='http://petersteinberger.com/2009/10/the-omni-groups-frameworks/' rel='bookmark' title='Permanent Link: The Omni Group&#8217;s frameworks'>The Omni Group&#8217;s frameworks</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/05/ipad-code-goldmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dashboard for iPad opensourced</title>
		<link>http://petersteinberger.com/2010/04/dashboard-for-ipad-opensourced/</link>
		<comments>http://petersteinberger.com/2010/04/dashboard-for-ipad-opensourced/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 12:45:47 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=804</guid>
		<description><![CDATA[Awesome: Dashboard for iPad is now on GitHub! The reason is not that awesome. It was rejected for &#8220;Contradicting iPad&#8217;s User Experience&#8221; Related posts:iPad Code Goldmine three20 and the AppStore Crash Reports on the iPhone


Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/ipad-code-goldmine/' rel='bookmark' title='Permanent Link: iPad Code Goldmine'>iPad Code Goldmine</a></li>
<li><a href='http://petersteinberger.com/2009/11/three20-and-the-appstore/' rel='bookmark' title='Permanent Link: three20 and the AppStore'>three20 and the AppStore</a></li>
<li><a href='http://petersteinberger.com/2010/02/crash-reports-on-the-iphone/' rel='bookmark' title='Permanent Link: Crash Reports on the iPhone'>Crash Reports on the iPhone</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Awesome: <a href="http://github.com/hongrich/Dashboard" target="_blank" class="liexternal">Dashboard for iPad is now on GitHub</a>!</p>
<p>The reason is not that awesome. It was <a href="http://gizmodo.com/5513525/ipad-dashboard-app-rejected-for-contradicting-ipads-user-experienceDashboard" target="_blank" class="liexternal">rejected</a> for &#8220;Contradicting iPad&#8217;s User Experience&#8221;</p>
<p><a href="http://petersteinberger.com/wp-content/uploads/2010/04/dashboard-ipad-04-09-2010.jpg" rel="lightbox[804]" title="dashboard-ipad-04-09-2010" class="liimagelink"><img class="alignnone size-full wp-image-805" title="dashboard-ipad-04-09-2010" src="http://petersteinberger.com/wp-content/uploads/2010/04/dashboard-ipad-04-09-2010.jpg" alt="" width="600" height="456" /></a></p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/05/ipad-code-goldmine/' rel='bookmark' title='Permanent Link: iPad Code Goldmine'>iPad Code Goldmine</a></li>
<li><a href='http://petersteinberger.com/2009/11/three20-and-the-appstore/' rel='bookmark' title='Permanent Link: three20 and the AppStore'>three20 and the AppStore</a></li>
<li><a href='http://petersteinberger.com/2010/02/crash-reports-on-the-iphone/' rel='bookmark' title='Permanent Link: Crash Reports on the iPhone'>Crash Reports on the iPhone</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/04/dashboard-for-ipad-opensourced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Foundation</title>
		<link>http://petersteinberger.com/2010/03/learning-foundation/</link>
		<comments>http://petersteinberger.com/2010/03/learning-foundation/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 21:30:46 +0000</pubDate>
		<dc:creator>studpete</dc:creator>
				<category><![CDATA[ObjectiveC]]></category>

		<guid isPermaLink="false">http://petersteinberger.com/?p=749</guid>
		<description><![CDATA[Damn. Didn&#8217;t knew about mutableCopy. [CC lang='objc'] NSArray * foo = SomeFunctionReturningAnNSArray(); NSMutableArray * bar = [foo mutableCopy]; [foo release]; [/CC] What other treasure lie around the Foundation? [CC lang='objc'] NSMutableArray *foo = SomeFunctionReturningAnNSMutableArray(); NSArray * bar = [foo copy]; [foo release]; [/CC] That&#8217;s actually pretty useful! NSArray is both faster and needs less memory [...]


Related posts:<ol><li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/11/core-data-notes-from-iphone-tech-talk/' rel='bookmark' title='Permanent Link: Core Data Notes from iPhone Tech Talk'>Core Data Notes from iPhone Tech Talk</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Damn. Didn&#8217;t knew about <a href="http://cocoadevcentral.com/articles/000065.php" target="_blank" class="liexternal">mutableCopy</a>.</p>
<p>[CC lang='objc']<br />
NSArray * foo = SomeFunctionReturningAnNSArray();<br />
NSMutableArray * bar = [foo mutableCopy];<br />
[foo release];<br />
[/CC]</p>
<p>What other treasure lie around the Foundation?</p>
<p>[CC lang='objc']<br />
NSMutableArray *foo = SomeFunctionReturningAnNSMutableArray();<br />
NSArray * bar = [foo copy];<br />
[foo release];<br />
[/CC]</p>
<p>That&#8217;s actually pretty useful! NSArray is both <em>faster</em> and needs <em>less memory</em> than his mutable counterpart.</p>
<!-- PHP 5.x -->

<p>Related posts:<ol><li><a href='http://petersteinberger.com/2010/03/better-iphonemac-logging-with-gtmlogger/' rel='bookmark' title='Permanent Link: Better iPhone/Mac logging with GTMLogger'>Better iPhone/Mac logging with GTMLogger</a></li>
<li><a href='http://petersteinberger.com/2009/11/core-data-notes-from-iphone-tech-talk/' rel='bookmark' title='Permanent Link: Core Data Notes from iPhone Tech Talk'>Core Data Notes from iPhone Tech Talk</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://petersteinberger.com/2010/03/learning-foundation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
