<?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>iPhone Dev Resource &#187; Accelerometer</title>
	<atom:link href="http://www.iphonedevresource.com/category/accelerometer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iphonedevresource.com</link>
	<description>[i canHas:info];</description>
	<lastBuildDate>Thu, 01 Apr 2010 12:41:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone/iPod Accelerometer Issues</title>
		<link>http://www.iphonedevresource.com/2008/11/iphoneipod-accelerometer-issues/</link>
		<comments>http://www.iphonedevresource.com/2008/11/iphoneipod-accelerometer-issues/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 08:06:46 +0000</pubDate>
		<dc:creator>J.Seuss</dc:creator>
				<category><![CDATA[Accelerometer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OpenGL ES]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod Touch]]></category>

		<guid isPermaLink="false">http://www.iphonedevresource.com/?p=8</guid>
		<description><![CDATA[If you&#8217;re struggling with odd behavior from your device&#8217;s accelerometer &#8216;every now and again&#8217; then you&#8217;re not alone.  
This post comments on the problem and some work arounds, and this is what I&#8217;ve found:
Problem:
A few devs out there have noticed the following symptoms

The accelerometer will not respond via the delegate at all in your app [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re struggling with odd behavior from your device&#8217;s accelerometer &#8216;every now and again&#8217; then you&#8217;re not alone.  </p>
<p>This <a href="http://discussions.apple.com/thread.jspa?messageID=8417664">post</a> comments on the problem and some work arounds, and this is what I&#8217;ve found:</p>
<h2>Problem:</h2>
<p>A few devs out there have noticed the following symptoms</p>
<ul>
<li>The accelerometer will not respond via the delegate at all in your app about 5% of the time when running your app</li>
<li>When combined with OpenGLES surfaces, the first drawn frame will be drawn between every new frame drawn to the surface.  This results in a flickering effect where a &#8216;ghost&#8217; of your initial drawing is interlaced with your normal frames.  </li>
</ul>
<p>Although some have reported these two problems being one and the same, I found them to be quite separate. I think many people are using the accelerometers+OpenGLES for games, and because the problems happen infrequently they seem related.  I could be wrong of course.  For the same reasons I could just be imagining that they <em>aren&#8217;t<span style="font-style: normal;"> related.</span></em></p>
<h2><em><span style="font-style: normal;">Work-arounds (not really solutions):</span></em></h2>
<h3>Accelerometer not working</h3>
<p>For the accelerometer, many have found (and I have too) that the problem seems to go away if you set the update frequency and delegate much later on in your app.</p>
<blockquote>
<pre><span>[[</span><span>UIAccelerometer</span><span> </span>sharedAccelerometer<span>] </span>setUpdateInterval<span>: (</span><span>1.0</span><span> / </span><span>kAccelerometerFrequency</span><span>)];</span>

<span><span>[[</span><span>UIAccelerometer</span><span> </span>sharedAccelerometer<span>] </span>setDelegate<span>:</span><span>self</span><span>];</span></span></pre>
</blockquote>
<p>Typically, you&#8217;ll call the above lines in</p>
<pre> - (<span>void</span>)applicationDidFinishLaunching:(<span>UIApplication</span> *)application</pre>
<p>but that&#8217;s what causes the problems.  Anyones best guess is that it just takes too long for the accelerometer to get ready some times and it just ignores your set delegate request. </p>
<h3>Flashing graphics</h3>
<p>I can&#8217;t confirm that this fix works, but some have reported that using kEAGLColorFormatRGBA8 instead of kEAGLColorFormatRGB565 on your OpenGLES surface will stop it happening.  I&#8217;ll give it a try and post my results here. If anyone can confirm or deny this fix, we&#8217;d love to hear from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevresource.com/2008/11/iphoneipod-accelerometer-issues/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

