<?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.mitchallen.com &#187; newbie</title>
	<atom:link href="http://mitchallen.com/iphone/archives/category/newbie/feed" rel="self" type="application/rss+xml" />
	<link>http://mitchallen.com/iphone</link>
	<description>random notes on iPhone development</description>
	<lastBuildDate>Tue, 10 Aug 2010 20:36:30 +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>Beginning iPhone Development</title>
		<link>http://mitchallen.com/iphone/archives/119</link>
		<comments>http://mitchallen.com/iphone/archives/119#comments</comments>
		<pubDate>Fri, 08 May 2009 18:58:32 +0000</pubDate>
		<dc:creator>Mitch  Allen</dc:creator>
				<category><![CDATA[book review]]></category>
		<category><![CDATA[newbie]]></category>
		<category><![CDATA[Apress]]></category>
		<category><![CDATA[LaMarche]]></category>

		<guid isPermaLink="false">http://mitchallen.com/iphone/?p=119</guid>
		<description><![CDATA[Because my main interest is in developing portable video games, my focus in the blog has been OpenGL ES. But if you want to know how to develop applications that don&#8217;t use OpenGL &#8211; the best book I&#8217;ve found so far is Beginning iPhone Development: Exploring the iPhone SDK. The book covers all the important [...]]]></description>
			<content:encoded><![CDATA[<p><iframe align="right" src="http://rcm.amazon.com/e/cm?t=mitchallen-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=1430216263&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="margin-left:10px;margin-right:10px;width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>Because my main interest is in developing portable video games, my focus in the blog has been OpenGL ES.  But if you want to know how to develop applications that don&#8217;t use OpenGL &#8211; the best book I&#8217;ve found so far is <a href="http://www.amazon.com/gp/product/1430216263?ie=UTF8&#038;tag=mitchallen-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1430216263">Beginning iPhone Development: Exploring the iPhone SDK</a><img src="http://www.assoc-amazon.com/e/ir?t=mitchallen-20&#038;l=as2&#038;o=1&#038;a=1430216263" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />.</p>
<p>The book covers all the important basics and shows you how to build an iPhone UI and wire up the buttons, etc.  In fact it&#8217;s the book I used to figure out how to write the touch handlers in the previous example.  Besides basic interaction (taps, touches, gestures), the book also covers what&#8217;s known in the iPhone as &#8220;views&#8221; (think of them as pages of your application).  It also covers things like how to design for rotation, acceleration, location, table views, tab bars, pickers, etc.  It even covers the basics of using SQLite3 to save data locally.</p>
<p>Once you are done reading the book, you may realize just how simple it is to recreate many of the apps that you see in the App Store and in the Apple commercials using ready made components supplied by the iPhone SDK.</p>
<p><iframe align="right" src="http://rcm.amazon.com/e/cm?t=mitchallen-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0321566157&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="margin-left:10px;margin-bottom:10px;width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>Even if you decide to just build an OpenGL ES app &#8211; you will probably still end up using views to create opening and configuration screens for your app.  So no matter what approach you take to developing iPhone apps, you will probably find the information in this book essential.</p>
<p>Besides Amazon &#8211; you can buy a PDF version of the book here:  <a href="http://www.apress.com/book/view/1430216263">http://www.apress.com/book/view/1430216263</a></p>
<p>Since the book is heavy in Objective-C code, you may also want to pick yourself up a copy of <a href="http://www.amazon.com/gp/product/0321566157?ie=UTF8&#038;tag=mitchallen-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0321566157">Programming in Objective-C 2.0 (2nd Edition) (Developer&#8217;s Library)</a><img src="http://www.assoc-amazon.com/e/ir?t=mitchallen-20&#038;l=as2&#038;o=1&#038;a=0321566157" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />.</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchallen.com/iphone/archives/119/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mixing C++ and Objective-C</title>
		<link>http://mitchallen.com/iphone/archives/64</link>
		<comments>http://mitchallen.com/iphone/archives/64#comments</comments>
		<pubDate>Fri, 10 Apr 2009 21:07:52 +0000</pubDate>
		<dc:creator>Mitch  Allen</dc:creator>
				<category><![CDATA[newbie]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://mitchallen.com/iphone/?p=64</guid>
		<description><![CDATA[I&#8217;ve been experimenting with mixing C++ and Objective-C. When you port C++ to the iPhone you will probably want to just add your code to an Objective-C project. Here are some of the issues that may lead to compiler warnings and errors: You need to change the extension of your C++ source files from *.cpp [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with mixing C++ and Objective-C. </p>
<p>When you port C++ to the iPhone you will probably want to just add your code to an Objective-C project. </p>
<p>Here are some of the issues that may lead to compiler warnings and errors:</p>
<ul>
<li>You need to change the extension of your C++ source files from *.cpp to *.mm</li>
<li>If you reference your C++ *.h file from a *.m file you will get weird syntax errors around your class definition.  The reason is because ANY file in your project that references a C++ *.h file must end in *.mm.  So if your Objective-C code references a C++ file, change the extension to *.mm.</li>
<li>You will get warnings that Objective-C ignores constructors and destructors.  So you will have to break out that code and call it after defining your object.</li>
<li>You will get a weird syntax error if you forget to put a semi-colon after your class definition ( class MyClass { &#8230; } <strong>;</strong> ).  This fixes the error &#8220;<em>error: new types may not be defined in a return type</em>&#8220;.  Xcode generates the brackets but doesn&#8217;t put the semi-colon in automatically.   So be on the lookout for that. You won&#8217;t get this error until you add a method that returns something.  If you started out with a bunch of void methods &#8211; then wonder why it suddenly broke &#8211; that&#8217;s why.</li>
<li>The virtual keyword isn&#8217;t allowed.  In Objective-C all methods are virtual.  If your derived class has a matching method, it will be called instead of the one in the base class &#8211; as if you did declare it virtual.</li>
</ul>
<p>See also:  <strong><a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html">Using C++ With Objective-C (developer.apple.com)</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://mitchallen.com/iphone/archives/64/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OpenGL and Mobile Devices: Round 2 (ddj.com)</title>
		<link>http://mitchallen.com/iphone/archives/57</link>
		<comments>http://mitchallen.com/iphone/archives/57#comments</comments>
		<pubDate>Sun, 05 Apr 2009 20:13:53 +0000</pubDate>
		<dc:creator>Mitch  Allen</dc:creator>
				<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[newbie]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://mitchallen.com/iphone/?p=57</guid>
		<description><![CDATA[Richard S. Wright, Jr. one of the authors of the OpenGL(R) SuperBible: Comprehensive Tutorial and Reference (4th Edition) has written an article for Doctor Dobb&#8217;s Journal: OpenGL and Mobile Devices: Round 2 &#8211; OpenGL ES for the iPhone and iPod Touch If you know basic OpenGL and are trying to get started on the iPhone, [...]]]></description>
			<content:encoded><![CDATA[<p><iframe align="right" src="http://rcm.amazon.com/e/cm?t=mitchallen-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0321498828&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="margin-left:10px;width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>Richard S. Wright, Jr. one of the authors of the <a href="http://www.amazon.com/gp/product/0321498828?ie=UTF8&#038;tag=mitchallen-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0321498828">OpenGL(R) SuperBible: Comprehensive Tutorial and Reference (4th Edition)</a><img src="http://www.assoc-amazon.com/e/ir?t=mitchallen-20&#038;l=as2&#038;o=1&#038;a=0321498828" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> has written an article for Doctor Dobb&#8217;s Journal:</p>
<p><a href="http://www.ddj.com/mobile/209600498">OpenGL and Mobile Devices: Round 2 &#8211; OpenGL ES for the iPhone and iPod Touch</a></p>
<p>If you know basic OpenGL and are trying to get started on the iPhone, this may be a good place to start.</p>
<p>UPDATE: Be forewarned &#8211; I have yet to successfully port the application listed in the article to the iPhone.  For suggestions see my next post about mixing C++.</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchallen.com/iphone/archives/57/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with OpenGL on the Mac</title>
		<link>http://mitchallen.com/iphone/archives/50</link>
		<comments>http://mitchallen.com/iphone/archives/50#comments</comments>
		<pubDate>Mon, 02 Mar 2009 19:28:40 +0000</pubDate>
		<dc:creator>Mitch  Allen</dc:creator>
				<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[newbie]]></category>
		<category><![CDATA[GLUT]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://mitchallen.com/iphone/?p=50</guid>
		<description><![CDATA[The iPhone uses a special form of OpenGL known as OpenGL ES. The ES stands for &#8220;embedded systems.&#8221; It&#8217;s a scaled back version to fit on small devices (like the iPhone). I&#8217;ve decided to teach myself Open GL first &#8211; then go through the pain of learning OpenGL ES &#8211; which means when I scale [...]]]></description>
			<content:encoded><![CDATA[<p>The iPhone uses a special form of <a href="http://www.khronos.org/opengl/">OpenGL</a> known as <a href="http://www.khronos.org/opengles/">OpenGL ES</a>.  The ES stands for &#8220;embedded systems.&#8221;  It&#8217;s a scaled back version to fit on small devices (like the iPhone).</p>
<p>I&#8217;ve decided to teach myself Open GL first &#8211; then go through the pain of learning OpenGL ES &#8211; which means when I scale back to ES, some features I&#8217;m going to learn about may be missing.  </p>
<p>Even though I&#8217;m more comfortable in Windows, I&#8217;m going to make life even more complicated by learning OpenGL on the Mac first.</p>
<p><strong>OpenGL on the Mac</strong></p>
<p>To get started developing for OpenGL on the Mac you are going to need Xcode.  See my previous post for information on that.  I&#8217;m assuming you are using the latest version of Mac OS X.</p>
<p>Then what you need to do is visit this link:</p>
<p><a href="http://blog.onesadcookie.com/2007/12/xcodeglut-tutorial.html">http://blog.onesadcookie.com/2007/12/xcodeglut-tutorial.html</a></p>
<p>At this point you could be done.  What I&#8217;m doing here is taking my notes from that article and compressing them.  In a few places I did things a little differently.  But in each case the goal was met:  have a working project that will compile OpenGL and GLUT code.</p>
<ol>
<li>In Xcode select: <strong>File / New Project &#8230;</strong></li>
<li>Under <strong>Mac OS X</strong> select: <strong>Other</strong></li>
<li>Click on: <strong>Empty Project</strong></li>
<li>Click: <strong>Choose &#8230;</strong></li>
<li>Select your development root directory</li>
<li>Click: <strong>New Folder</strong></li>
<li>Give the folder the name of your project, like <em>TestOpenGL</em></li>
<li>For <strong>Save As</strong> enter the name of your project, like <em>TestOpenGL</em></li>
<li>Click: <strong>Save</strong> </li>
<li>Under <strong>Groups &amp; Files</strong> right-click on <strong>Targets</strong></li>
<li>Select: <strong>Add / New Target &#8230;</strong></li>
<li>Under <strong>Mac OS X</strong> select: <strong>Cocoa</strong></li>
<li>Select: <strong>Application</strong></li>
<li>Click: <strong>Next</strong></li>
<li>Enter a <strong>Target Name</strong>, like <em>TestOpenGL</em></li>
<li>Click: <strong>Finish</strong></li>
<li>You&#8217;ll be presented with a <strong>Target &#8220;<em>TestOpenGL</em>&#8221; Info</strong> window</li>
<li>Scroll to the bottom and double click: <strong>GCC_PREFIX_HEADER</strong></li>
<li>Clear the contents and click <strong>OK</strong></li>
<li>Close the <strong>Info</strong> window</li>
<li>In the <strong>Groups &amp; Files</strong> window of Xcode, right click on the <strong>Products</strong> folder</li>
<li>Select: <strong>Add / Existing Frameworks &#8230;</strong></li>
<li>Expand: <strong>Frameworks</strong></li>
<li>Select: <strong>GLUT.framework</strong></li>
<li>Apple-key + click <strong>OpenGL.framework</strong></li>
<li>Click: <strong>Add</strong></li>
<li>You&#8217;ll see a dialog box, just use the defaults and click <strong>Add</strong></li>
<li>In the <strong>Groups &amp; Files</strong> window of Xcode, right click on the <strong>Products</strong> folder</li>
<li>Select: <strong>Add / New File &#8230;</strong></li>
<li>Under <strong>Mac OS X</strong> select: <strong>C and C++</strong></li>
<li>Select: <strong>C File</strong></li>
<li>Click: <strong>Next</strong></li>
<li>Name it <strong>main.c</strong></li>
<li>Click: <strong>Finish</strong></li>
</ol>
<div>Now you have a main.c file where you can plug in OpenGL code &#8211; including code that uses the GLUT framework &#8211; from your favorite tutorial. It should compile and run on the Mac just fine.</div>
]]></content:encoded>
			<wfw:commentRss>http://mitchallen.com/iphone/archives/50/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with iPhone Development</title>
		<link>http://mitchallen.com/iphone/archives/5</link>
		<comments>http://mitchallen.com/iphone/archives/5#comments</comments>
		<pubDate>Thu, 04 Dec 2008 16:29:24 +0000</pubDate>
		<dc:creator>Mitch  Allen</dc:creator>
				<category><![CDATA[newbie]]></category>
		<category><![CDATA[distribution]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://mitchallen.com/iphone/?p=5</guid>
		<description><![CDATA[Here are my notes on getting started with the iPhone SDK (Software Development Kit). I encountered a few issues which I will describe here. You Need a Mac To develop for the iPhone and iPod Touch you need a Mac running Leopard (10.5). Earlier versions of the Mac OS won&#8217;t do. Bundled with Leopard is [...]]]></description>
			<content:encoded><![CDATA[<p>Here are my notes on getting started with the iPhone SDK (Software Development Kit). I encountered a few issues which I will describe here.</p>
<p><strong>You Need a Mac</strong></p>
<p>To develop for the iPhone and iPod Touch you need a Mac running Leopard (10.5). Earlier versions of the Mac OS won&#8217;t do. Bundled with Leopard is a free IDE called <a href="http://developer.apple.com/tools/xcode/"><span style="color: #5588aa;">Xcode</span></a>. Once you have Xcode up and running, you need to go to <a href="http://developer.apple.com/iphone/"><span style="color: #5588aa;">http://developer.apple.com/iphone/</span></a>, create a login, and download the iPhone SDK on to your Mac.</p>
<p><strong>Objective-C</strong></p>
<p>Some of you may freak out at this point at the thought of learning another programming language. The de facto standard for programming for the iPhone is Objective-C. You can also do some coding in C++. But most everyone is working in Objective-C. The Apple site has tutorials on iPhone development and there are tutorials out there on Objective-C. So I&#8217;m not going to repeat that stuff here.</p>
<p><strong>Simulation is Free, Distribution is $99</strong></p>
<p>You can build your application on the Mac using Xcode and run it in an iPhone simulator for free. But if you actually want to try your code on your iPhone or iPod Touch, you are going to have to plunk down $99 and join the <strong>iPhone Developer Program</strong> (or more if you are part of a larger enterprise).</p>
<p>Once signed up you will find that when you login to <a href="http://developer.apple.com/iphone/"><span style="color: #5588aa;">http://developer.apple.com/iphone/</span></a> you have a new button that leads to the <strong>iPhone Developer Program Portal</strong>. This is where you go to manage certificates that you will need to develop for the device. The steps are laid out for the most part. So again I&#8217;m not going to repeat instructions that are available online. But I did run into a few issues that I will document here.</p>
<p><strong>Issue #1: Unable to locate a suitable developer disk image</strong></p>
<p>I own the latest iPod Touch that comes with 2.1.1 installed. When I tried to create my app in Xcode I got an error dialog that said <em>&#8220;Unable to locate a suitable developer disk image.&#8221;</em> I found a solution to my problem <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/4216-unable-locate-suitable-developer-disk-image.html"><strong><span style="color: #5588aa;">here</span></strong></a>. To quote from the thread:</p>
<p>You will need to create the following symlink:<br />
&#8230;/iPhoneOS.platform/DeviceSupport/2.1.1/<br />
pointing at:<br />
&#8230;/iPhoneOS.platform/DeviceSupport/2.1/</p>
<p>To do that, open up a terminal window (command prompt) and enter the following:</p>
<p>cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport<br />
ln -s 2.1/ 2.1.1</p>
<p><strong>Issue #2: Signing Your Name</strong></p>
<p>Once you have access to the developer portal you will find instructions under the <strong>Provision / How To </strong>section that tell you to do this:</p>
<p><em>In the Project Info window select the ‘Build’ tab and enter “iPhone Developer: YourFirstName YourLastName” in the ‘Code Signing Identity’-&gt;’Any iPhone OS’ field setting. This is also the Common Name of your iPhone Development Certificate. (Note: Be sure to include the space between the ‘:’ and ‘YourFirstName’.)</em></p>
<p>So reading that, I entered &#8220;<em>iPhone Developer: <strong>Mitch</strong> Allen</em>&#8221; &#8211; it didn&#8217;t work. Why? Because when I signed up for the developer program I used my full name so it would match my credit card. What I needed to do was set this to &#8220;<em>iPhone Developer: <strong>Mitchell</strong> Allen</em>.&#8221;</p>
<p><strong>Issue #3: Error 0xE800003A</strong></p>
<p>When trying to load and run the application on the actual device you get this rather cryptic error: <em>&#8220;Your mobile device has encountered an unexpected error (0xE800003A) during the install phase.&#8221;</em></p>
<p>The closest thing I found to a solution was <a href="http://www.modmyi.com/forums/iphone-ipod-touch-sdk-development-discussion/351731-your-mobile-device-has-encountered-unexpected-error-0xe800003a-during-instal.html"><span style="color: #5588aa;">here</span></a>.</p>
<p>The instructions for creating certificates for your application tell you to create an identifier like this: <strong>com.<em>yourcompany</em>.<em>yourapp</em></strong>. I was experimenting by creating an app based on Conways Game of Life. So my identifier was &#8220;<strong>com.mitchallen.life2</strong>.&#8221; To make the dreaded error code go away I almost followed the instructions in the thread. What I did was edit the <strong>Bundle Identifier</strong> in <strong>info.plist</strong> to be:</p>
<p><strong>com.mitchallen.${PRODUCT_NAME:Identifier}</strong></p>
<p>I hope this helps!</p>
<p>You may also want to read this article: <a href="http://www.mikeash.com/?page=pyblog/the-iphone-development-story.html"><span style="color: #5588aa;">The iPhone Development Story</span></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchallen.com/iphone/archives/5/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
