<?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>Chris Danielson&#039;s Blog &#187; Development</title>
	<atom:link href="http://www.chrisdanielson.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisdanielson.com</link>
	<description>Trials and Tribulations of a Software Developer</description>
	<lastBuildDate>Wed, 14 Sep 2011 00:00:51 +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>iPhone Network Connectivity Test Example</title>
		<link>http://www.chrisdanielson.com/2009/07/22/iphone-network-connectivity-test-example/</link>
		<comments>http://www.chrisdanielson.com/2009/07/22/iphone-network-connectivity-test-example/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 03:09:05 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Network Test]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[SCNetworkReachability]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=70</guid>
		<description><![CDATA[Every iPhone developer that has integrated a network connection based application has had to follow the Apple HID (Human Interface Design) rules. This means, that in order to get the Apple reviewers to sign-off on your application, you have to pass the network connectivity test. Basically, in the case of a catastrophic network disconnect issue [...]]]></description>
			<content:encoded><![CDATA[<p>Every iPhone developer that has integrated a network connection based application has had to follow the Apple <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html">HID (Human Interface Design)</a> rules.  This means, that in order to get the Apple reviewers to sign-off on your application, you have to pass the network connectivity test.  Basically, in the case of a catastrophic network disconnect issue with 3G and WiFi does your application properly alert the user that it will not perform properly without the usage of the network?  I&#8217;ve seen a lot of workaround techniques where users attempt to do an HTTP GET on say Google or some other website.  Clearly, this kind of technique will work sporadically in an unknown environment common to the mobile device.  I mean, imagine causing your application users to sit through a 5-30 second web request timeout.  The end-user will probably believe that the application is hung.  The ideal solution happens to be handed to us in the API Framework <a href="http://developer.apple.com/iphone/library/documentation/SystemConfiguration/Reference/SCNetworkReachabilityRef/Reference/reference.html">SCNetworkReachability</a>.  (<i>Make sure your codebase is linked properly with the &#8220;SystemConfiguration&#8221; Framework</i>).<br />
It&#8217;s worked for me and I recommend it for doing a simple network connectivity test.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p70code2'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p702"><td class="code" id="p70code2"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;sys/socket.h&gt;</span>
<span style="color: #6e371a;">#import &lt;netinet/in.h&gt;</span>
<span style="color: #6e371a;">#import &lt;arpa/inet.h&gt;</span>
<span style="color: #6e371a;">#import &lt;netdb.h&gt;</span>
<span style="color: #6e371a;">#import &lt;SystemConfiguration/SCNetworkReachability.h&gt;</span>
<span style="color: #11740a; font-style: italic;">//Snip, you know we're in the implementation...</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> connectedToNetwork
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// Create zero addy</span>
	<span style="color: #a61390;">struct</span> sockaddr_in zeroAddress;
	bzero<span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>zeroAddress, <a href="http://www.opengroup.org/onlinepubs/009695399/functions/sizeof.html"><span style="color: #a61390;">sizeof</span></a><span style="color: #002200;">&#40;</span>zeroAddress<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
	zeroAddress.sin_len <span style="color: #002200;">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/sizeof.html"><span style="color: #a61390;">sizeof</span></a><span style="color: #002200;">&#40;</span>zeroAddress<span style="color: #002200;">&#41;</span>;
	zeroAddress.sin_family <span style="color: #002200;">=</span> AF_INET;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// Recover reachability flags</span>
	SCNetworkReachabilityRef defaultRouteReachability <span style="color: #002200;">=</span> SCNetworkReachabilityCreateWithAddress<span style="color: #002200;">&#40;</span><span style="color: #a61390;">NULL</span>, <span style="color: #002200;">&#40;</span><span style="color: #a61390;">struct</span> sockaddr <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&amp;</span>zeroAddress<span style="color: #002200;">&#41;</span>;
	SCNetworkReachabilityFlags flags;
&nbsp;
	<span style="color: #a61390;">BOOL</span> didRetrieveFlags <span style="color: #002200;">=</span> SCNetworkReachabilityGetFlags<span style="color: #002200;">&#40;</span>defaultRouteReachability, <span style="color: #002200;">&amp;</span>flags<span style="color: #002200;">&#41;</span>;
	CFRelease<span style="color: #002200;">&#40;</span>defaultRouteReachability<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>didRetrieveFlags<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">return</span> <span style="color: #a61390;">NO</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">BOOL</span> isReachable <span style="color: #002200;">=</span> flags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsReachable;
	<span style="color: #a61390;">BOOL</span> needsConnection <span style="color: #002200;">=</span> flags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsConnectionRequired;
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span>isReachable <span style="color: #002200;">&amp;&amp;</span> <span style="color: #002200;">!</span>needsConnection<span style="color: #002200;">&#41;</span> ? <span style="color: #a61390;">YES</span> <span style="color: #002200;">:</span> <span style="color: #a61390;">NO</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//call like:</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> start <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span>self connectedToNetwork<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                UIAlertView <span style="color: #002200;">*</span>alert <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIAlertView alloc<span style="color: #002200;">&#93;</span> 
                         initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Network Connection Error&quot;</span> 
                         message<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;You need to be connected to the internet to use this feature.&quot;</span> 
                         delegate<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;OK&quot;</span> otherButtonTitles<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#91;</span>alert show<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#91;</span>alert release<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span> <span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span>
             <span style="color: #11740a; font-style: italic;">//do something </span>
        <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>This code can also be found on this <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/7300-test-if-internet-connection-available.html">forum</a> post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/07/22/iphone-network-connectivity-test-example/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>.Net C Sharp Date Range Check Method</title>
		<link>http://www.chrisdanielson.com/2009/07/21/net-c-sharp-date-range-check-method/</link>
		<comments>http://www.chrisdanielson.com/2009/07/21/net-c-sharp-date-range-check-method/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 16:04:50 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[.Net Development]]></category>
		<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Date Range]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=58</guid>
		<description><![CDATA[This function is a trivial example of how to do a basic date range check in .Net. I do a few silly conversions from string to timestamp only to serve as an example. View Code CSHARP/* Assumes the local culture. Does a check to see if the current time is within the range of 7 [...]]]></description>
			<content:encoded><![CDATA[<p>This function is a trivial example of how to do a basic date range check in .Net.  I do a few silly conversions from string to timestamp only to serve as an example.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code5'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p585"><td class="code" id="p58code5"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">/*
Assumes the local culture.  
Does a check to see if the current time is within the range 
  of 7 AM and 1 PM.  If so, returns true.
*/</span>
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>IsCurrentDateInRange<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;7:00&quot;</span>, <span style="color: #666666;">&quot;13:00&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
   <span style="color: #008080; font-style: italic;">//The current date is in range.</span>
<span style="color: #008000;">&#125;</span> <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #008000;">&#123;</span>
  <span style="color: #008080; font-style: italic;">//The current date is out of range.</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p58code6'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p586"><td class="code" id="p58code6"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">/*
startTime should be in the format HH:mm such as 09:45
endTime should be in the format HH:mm such as 18:45
The culture is assumed to be the local one which can be 
troubling in applications that extend themselves internationally.
*/</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">bool</span> IsCurrentDateInRange<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> startTime, <span style="color: #6666cc; font-weight: bold;">string</span> endTime<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
  DateTime dtNow <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">;</span>
  DateTime dtStart, dtEnd<span style="color: #008000;">;</span>
  <span style="color: #6666cc; font-weight: bold;">int</span> hour <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>, minute <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
  <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> strDt <span style="color: #008000;">=</span> startTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">':'</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
     Int32<span style="color: #008000;">.</span><span style="color: #0000FF;">TryParse</span><span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span>, <span style="color: #0600FF; font-weight: bold;">out</span> hour<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
     Int32<span style="color: #008000;">.</span><span style="color: #0000FF;">TryParse</span><span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span>, <span style="color: #0600FF; font-weight: bold;">out</span> minute<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
     dtStart <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DateTime<span style="color: #008000;">&#40;</span>dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Year</span>, dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Month</span>, dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Day</span>, hour, minute, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0600FF; font-weight: bold;">else</span>
  <span style="color: #008000;">&#123;</span>
     <span style="color: #008080; font-style: italic;">//TODO: log an error in formatting.</span>
     <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>               
&nbsp;
  strDt <span style="color: #008000;">=</span> endTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">char</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> <span style="color: #666666;">':'</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
     hour <span style="color: #008000;">=</span> minute <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
     Int32<span style="color: #008000;">.</span><span style="color: #0000FF;">TryParse</span><span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span>, <span style="color: #0600FF; font-weight: bold;">out</span> hour<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
     Int32<span style="color: #008000;">.</span><span style="color: #0000FF;">TryParse</span><span style="color: #008000;">&#40;</span>strDt<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span>, <span style="color: #0600FF; font-weight: bold;">out</span> minute<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
     dtEnd <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DateTime<span style="color: #008000;">&#40;</span>dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Year</span>, dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Month</span>, dtNow<span style="color: #008000;">.</span><span style="color: #0000FF;">Day</span>, hour, minute, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0600FF; font-weight: bold;">else</span>
  <span style="color: #008000;">&#123;</span>
     <span style="color: #008080; font-style: italic;">//TODO: log an error in formatting.</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  TimeSpan tsEndDiff <span style="color: #008000;">=</span> dtEnd <span style="color: #008000;">-</span> dtNow<span style="color: #008000;">;</span>
  TimeSpan tsStartDiff <span style="color: #008000;">=</span> dtNow <span style="color: #008000;">-</span> dtStart<span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>tsStartDiff<span style="color: #008000;">.</span><span style="color: #0000FF;">TotalSeconds</span> <span style="color: #008000;">&gt;=</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&amp;&amp;</span> tsEndDiff<span style="color: #008000;">.</span><span style="color: #0000FF;">TotalSeconds</span> <span style="color: #008000;">&gt;=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
     <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0600FF; font-weight: bold;">else</span> 
     <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/07/21/net-c-sharp-date-range-check-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone (SIGBUS) Issue</title>
		<link>http://www.chrisdanielson.com/2009/07/20/iphone-sigbus-issue/</link>
		<comments>http://www.chrisdanielson.com/2009/07/20/iphone-sigbus-issue/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 02:08:57 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[SIGBUS]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=26</guid>
		<description><![CDATA[If you&#8217;ve ever done any iPhone development, you&#8217;ve probably had an accident with the (nonatomic, retain) methods. These methods are difficult to use in the case where you&#8217;re working with multiple threads. Our application does not do this, but we do utilize the OpenGL ES 1.1 framework. Have a look at the following console log [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever done any iPhone development, you&#8217;ve probably had an accident with the (nonatomic, retain) methods.  These methods are difficult to use in the case where you&#8217;re working with multiple threads.  Our application does not do this, but we do utilize the OpenGL ES 1.1 framework.  Have a look at the following console log from the other night when my brother was beta testing our application with some friends at a bar.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p26code10'); return false;">View Code</a> IPHONE_CONSOLE_LOG</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2610"><td class="code" id="p26code10"><pre class="iphone_console_log" style="font-family:monospace;">Process:         myExampleApp [800]
Path:            /var/mobile/Applications/5D234CF0-1234-4E2F-9A7F-14175F39A0B6/myExampleApp.app/myExampleApp
Identifier:      myExampleApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]
&nbsp;
Date/Time:       2009-07-19 23:20:40.285 -0700
OS Version:      iPhone OS 3.0 (7A341)
Report Version:  104
&nbsp;
Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000008
Crashed Thread:  0
&nbsp;
Thread 0 Crashed:
0   libobjc.A.dylib                   0x30011940 objc_msgSend + 20
1   libobjc.A.dylib                   0x3001313c objc_setProperty + 160
2   myExampleApp                          0x000126e6 -[GameUIView setBasicObj:] (GameUIView.m:36)
3   myExampleApp                          0x0000f694 -[GameUIView setupView] (GameUIView.m:404)
4   myExampleApp                          0x0000ec42 -[GameUIView start] (GameUIView.m:173)
5   myExampleApp                          0x00002816 -[CoreViewController playGame] (CoreViewController.m:79)
6   myExampleApp                          0x00005e80 -[SplashGLUIView touchesEnded:withEvent:] (SplashGLUIView.m:606)
7   UIKit                             0x309a60d4 -[UIWindow _sendTouchesForEvent:] + 520
8   UIKit                             0x309a5464 -[UIWindow sendEvent:] + 108
9   UIKit                             0x30936e3c -[UIApplication sendEvent:] + 400
10  UIKit                             0x30936874 _UIApplicationHandleEvent + 4336
11  GraphicsServices                  0x32046964 PurpleEventCallback + 1028
12  CoreFoundation                    0x30254a70 CFRunLoopRunSpecific + 2296
13  CoreFoundation                    0x30254164 CFRunLoopRunInMode + 44
14  GraphicsServices                  0x3204529c GSEventRunModal + 188
15  UIKit                             0x308f0374 -[UIApplication _run] + 552
16  UIKit                             0x308eea8c UIApplicationMain + 960
17  myExampleApp                          0x000020b6 main (main.m:14)
18  myExampleApp                          0x0000202c start + 44</pre></td></tr></table></div>

<p>The core method here that is the issue is implemented as:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p26code11'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2611"><td class="code" id="p26code11"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//in the .h file.  </span>
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> <span style="color: #002200;">*</span>basicObj;
&nbsp;
<span style="color: #11740a; font-style: italic;">//in the .m file.</span>
<span style="color: #a61390;">@synthesize</span> basicObj;
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>setupView
<span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self.basicObj <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		<span style="color: #002200;">&#91;</span>self.basicObj release<span style="color: #002200;">&#93;</span>;
		self.basicObj <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>; <span style="color: #11740a; font-style: italic;">//line 404, this is where the error is located.</span>
   <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>As you can see, the issue appears to be based on how we access the basicObj object.  The definition of a <a href="http://en.wikipedia.org/wiki/SIGBUS">SIGBUS</a> error, is pretty straight forward.  We are generically having some sort of memory issue.</p>
<p>As of this writing, I&#8217;m still doing extensive testing and I&#8217;ll update this post if I find a better solution.  Here is what I&#8217;ve found to work.  I&#8217;m beginning to wonder if there is a funny timing issue with the &#8220;release&#8221; methodology.  I&#8217;ll make sure to post back here if I find there to still be an issue or I find a better solution.  Comments are appreciated.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p26code12'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2612"><td class="code" id="p26code12"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>setupView
<span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self.basicObj <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		<span style="color: #002200;">&#91;</span>basicObj release<span style="color: #002200;">&#93;</span>;
		basicObj <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/07/20/iphone-sigbus-issue/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

