<?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>myCodeStudio</title>
	<atom:link href="http://www.mycodestudio.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mycodestudio.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 22 Mar 2010 01:10:25 +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>Wading in the Free Pool</title>
		<link>http://www.mycodestudio.com/blog/2010/03/18/wading-in-the-free-pool/</link>
		<comments>http://www.mycodestudio.com/blog/2010/03/18/wading-in-the-free-pool/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 15:19:47 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mycodestudio.com/blog/?p=100</guid>
		<description><![CDATA[On March 13th, Kascade was available for free through OpenFeint's Free Game Of The Day promotion. As this was the first time Kascade was available for free, I wasn't sure what the demand would be. 
Well as it turns out people love free stuff! I was quite surprised by the demand! I'm sure OpenFeint's marketing [...]]]></description>
			<content:encoded><![CDATA[<p>On March 13th, <a href="http://itunes.apple.com/us/app/kascade/id306361038?mt=8">Kascade</a> was available for free through <a href="http://openfeint.com">OpenFeint</a>'s <a href="http://freegameoftheday.com/">Free Game Of The Day</a> promotion. As this was the first time Kascade was available for free, I wasn't sure what the demand would be. </p>
<p>Well as it turns out people love free stuff! I was quite surprised by the demand! I'm sure OpenFeint's marketing helped drive up the demand in addition to the free cost. </p>
<p>So for the 28 hours (approximately) that Kascade was given away, the final numbers are:</p>
<p>- Total downloaded: 36,142<br />
- Peaked at #91 for all the Free Apps (US)<br />
- Peaked at #52 on the Free Games category<br />
- Peaked at #8 on the Free Games - Puzzle category<br />
- Peaked at #8 on the Free Games - Family category</p>
<p>After Kascade returned to the normal $0.99 price, there was a definite uptick in sales. Still early to tell if the sales will continue to stay at a higher level or will eventually return to the pre-sale levels. </p>
<p>Overall, I am quite pleased with participating in their giveaway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2010/03/18/wading-in-the-free-pool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UITextView Scrolling</title>
		<link>http://www.mycodestudio.com/blog/2009/12/22/uitextview-scrolling/</link>
		<comments>http://www.mycodestudio.com/blog/2009/12/22/uitextview-scrolling/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 04:10:38 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=83</guid>
		<description><![CDATA[After hours of fiddling (and cursing) with the UITextView scrolling behavior, I finally got the behavior I wanted. If you ever need to programmatically insert text into a UITextView and move the cursor to right after the insertion point, the following code snippet should work. Make sure you do the bolded items otherwise the UITextView [...]]]></description>
			<content:encoded><![CDATA[<p>After hours of fiddling (and cursing) with the UITextView scrolling behavior, I finally got the behavior I wanted. If you ever need to programmatically insert text into a UITextView and move the cursor to right after the insertion point, the following code snippet should work. Make sure you do the bolded items otherwise the UITextView won't scroll properly. <span id="more-83"></span></p>
<pre><strong>textview.scrollEnabled = NO;</strong>
NSString *contentsToAdd = @"some string";
NSInteger len = [contentsToAdd length];
NSRange cursorPosition = [self.textview selectedRange];
NSMutableString *tfContent = [[NSMutableString alloc] initWithString:[self.textview text]];

<span style="color: #008000;">// insert the string or replace the selection</span>
NSUInteger loc = cursorPosition.location;
if (cursorPosition.length == 0)
  [tfContent insertString:contentsToAdd atIndex:loc];
else
  [tfContent replaceCharactersInRange:cursorPosition withString:contentsToAdd];

<span style="color: #008000;">// now update the text view</span>
[self.text setText:tfContent];
cursorPosition.location = loc + len;
cursorPosition.length = 0;

<span style="color: #008000;">// should move the cursor</span>
<strong>textview.scrollEnabled = YES;</strong>
self.textview.selectedRange = cursorPosition;
[tf release];</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/12/22/uitextview-scrolling/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>cocos2d Part1</title>
		<link>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/</link>
		<comments>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 02:40:09 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=57</guid>
		<description><![CDATA[Just started development of a new iPhone game and decided to use cocos2d for the game engine (versus the one built for Kascade). Since there are upcoming API changes, I started with the latest 0.9 alpha/beta (latest tips from subversion) since it will likely be released before the game will be completed.
This entry is part [...]]]></description>
			<content:encoded><![CDATA[<p>Just started development of a new iPhone game and decided to use <a href="http://www.cocos2d-iphone.org/" target="_blank">cocos2d</a> for the game engine (versus the one built for Kascade). Since there are upcoming API changes, I started with the latest 0.9 alpha/beta (latest tips from subversion) since it will likely be released before the game will be completed.</p>
<p>This entry is part 1 of a series that provides a starting point for anyone using cocos2d. This post kicks things off with useful links and setting up your project.<br />
<span id="more-57"></span></p>
<h2>Starting Links</h2>
<p>In addition to the main <a href="http://www.cocos2d-iphone.org/">cocos2d</a> site, the following is a list of links that I found helpful in starting development:</p>
<ul>
<li><a href="http://monoclestudios.com/cocos2d_whitepaper.html" target="_blank">http://monoclestudios.com/cocos2d_whitepaper.html</a></li>
<li><a href="http://lethain.com/entry/2008/oct/03/notes-on-cocos2d-iphone-development/" target="_blank">http://lethain.com/entry/2008/oct/03/notes-on-cocos2d-iphone-development/</a></li>
<li><a href="http://beta.letstalkiphone.com/2009/05/tic-tac-toe-in-cocos2d/" target="_blank">http://beta.letstalkiphone.com/2009/05/tic-tac-toe-in-cocos2d/</a></li>
<li><a href="http://mitchallen.com/iphone/archives/254" target="_blank">Misc links including the ones above</a></li>
</ul>
<p>All the links above refer to the older versions of cocos2d and so all the examples will have to be slightly modified (new in 0.9 is that all classes are now prefixed with CC).</p>
<h2>Setting Up</h2>
<p>The good news that as of 0.8.1, cocos2d provides XCode templates to start your own project. It installs three templates: basic cocos2d, cocos2d + Box2D, and cocos2d + Chipmunk. Box2D and Chipmunk are two different physics engines (Chipmunk was derived from an early version of Box2D). Box2D is C++ and Chipmunk is C.</p>
<p>Once you select the XCode template, you have a simple example application that runs in the simulator after a build.</p>
<p>One thing to note is that the template copies all the cocos2d files (and its dependencies) into your project directory. This will be problematic if you to update your cocos2d install like I will need to do (especially with the pre-beta) since I would need to recopy all the files again. That sounds painful so there should be a better/easier way... static libraries to the rescue!</p>
<h2>Static Libraries</h2>
<p>Doing some research on the web, these two links provided most of the relevant information to enable making cocos2d a static library.</p>
<ul>
<li><a href="http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html" target="_blank">http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html</a></li>
<li><a href="http://www.clintharris.net/2009/iphone-app-shared-libraries/" target="_blank">http://www.clintharris.net/2009/iphone-app-shared-libraries/</a></li>
</ul>
<p>The first link shows how to create static libraries and use them in XCode for the iPhone. I'm not sure about prior releases, but the 0.9 version comes with static libraries already included as targets in the XCode project file so this link wasn't as relevant for the setup side of things (although it is a great read).</p>
<p>However, it did point out that you would need a version for every device/simulator combination you want to work with. Not ideal. After reading the second article, there is a way to avoid that.</p>
<p>Before I get into that, you should remove the 'cocos2d sources' from your newly created project. Down in the <strong>Targets</strong> section, remove the 'cocos2d libraries'.</p>
<p><img class="aligncenter size-full wp-image-75" title="LeftSide" src="http://mycodestudio.com/blog/wp-content/uploads/2009/12/LeftSide.png" alt="LeftSide" width="280" height="450" /></p>
<p>Right click on your main target and <strong>Get Info</strong>. On the <strong>General</strong> tab, remove the 'cocos2d libraries' reference from the <strong>Direct Dependencies</strong> as well as under the <strong>Linked Libraries</strong> section.</p>
<p><img class="aligncenter size-full wp-image-78" title="TargetInfo" src="http://mycodestudio.com/blog/wp-content/uploads/2009/12/TargetInfo.png" alt="TargetInfo" width="488" height="411" /></p>
<p>At this point, I followed Clint's steps (from the second article) - except I skipped his first one: <strong>Set up a <em>shared build output </em></strong><strong>directory that will be shared by all Xcode projects.</strong></p>
<p>I didn't do this and everything seems to work fine since the referenced project will build based on your current settings. Of course, I just started my development with this so time will tell if I really needed it.</p>
<p>Once you get to the step called <strong>Configure the Library Dependencies, Linking, and Header Files</strong>, you just copy the subset of libraries from the cocos2d project reference. A good starting point for inclusion: cocos2d. Chipmunk (for physics), libpng, and CocosDenshion (for sound).</p>
<h3>A Few Notes</h3>
<p>In 0.9 libcocos2d.a actually includes FontLabel so you don't need to explicitly pull that in (if you do you will have an issue with a duplicate symbol).</p>
<p>You will need to make a single change in this version of cocos2d in order to get the libpng.a to work. Open the cocos2d project and for the libpng target, remove (uncheck) the pngtest.c from the libpng static library target. This file has a main which causes a duplicate symbol issue when compiled in with your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenFeint Integration</title>
		<link>http://www.mycodestudio.com/blog/2009/12/01/openfeint-integration/</link>
		<comments>http://www.mycodestudio.com/blog/2009/12/01/openfeint-integration/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 02:32:08 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=45</guid>
		<description><![CDATA[Well Kascade 1.1 finally hit the App Store today! It now integrates with OpenFeint, but just their Achievements and not their online Scoreboard (as they only have a single scoreboard and the current Kascade scoreboard breaks it down by all-time and the last 7 days). The OpenFeint Achievement system is pretty nice and adds an [...]]]></description>
			<content:encoded><![CDATA[<p>Well Kascade 1.1 finally hit the App Store today! It now integrates with <a href="http://www.openfeint.com">OpenFeint</a>, but just their Achievements and not their online Scoreboard (as they only have a single scoreboard and the current Kascade scoreboard breaks it down by all-time and the last 7 days). The OpenFeint Achievement system is pretty nice and adds an extra incentive to keep playing.</p>
<p>The integration was painless. After registering on their site, I followed the post on <a href="http://vimeo.com/5633994">how to integrate OpenFeint in 19 minutes</a>. For the Achievements, you use the OpenFeint website to create one or more achievements to unlock (Kascade currently has 60). Originally, you had to enter your achievements in the order that you wanted them to appear, but they've pushed out an update that now allows reordering - that really helps! I used a spreadsheet to list all the names and point values for all 60 achievements so it would be easier to change and balance rather than flipping through different webpages. Then I entered them in one by one.<br />
<span id="more-45"></span><br />
A few things to note:</p>
<ul>
<li>OpenFeint is in C++ so you have to change any files that reference it to .mm (instead of .m). To minimize this, I created an OFHandler class that made the majority of the OpenFeint API calls. My classes would then my OFHandler singleton. See the code snippet below.</li>
<li>OpenFeint's SDK has all the source code, so its easier to figure out how things really work. For example, I wanted to call their [OFAchievementService unlockAchievement: &lt;insert_value_here&gt;] API call every time a certain number of blocks were removed. I didn't want to do a network hit every time for this, but the code showed it used a database to store the achievements that were already awarded so it wouldn't make the network call again.</li>
<li>OpenFeint's Achievements do not work offline (unlike their scoreboard). Hopefully they will fix this in a new release as this would be very useful. I could write my own logic, but I'll wait and see first.</li>
<li>They auto generate #defines for all your achievements so you don't have to know the numeric value. See the OFHandler.mm section below for an example of usage.</li>
</ul>
<p>All-in-all, the OpenFeint system has been great to work with. They seem committed to adding new features and provide excellent support. If your game can take advantage of an online scoreboard/leaderboard or achievements I highly recommend it!</p>
<p><img class="aligncenter size-full wp-image-51" title="Blocks33" src="http://mycodestudio.com/blog/wp-content/uploads/2009/12/Blocks33.jpg" alt="Blocks33" width="480" height="320" /></p>
<h3>OFHandler.h</h3>
<pre>// your class would differ based on your achievements</pre>
<pre>@interface OFHandler : NSObject {

}

- (void) unlockAchievementForRemaining: (NSInteger) remaining colorCount: (GameMode) colorMode;

- (void) unlockAchievementForScore: (NSInteger) score;

- (void) unlockAchievementForColumns: (NSInteger) colCount totalCount: (NSInteger) total colorCount: (GameMode) colorMode;

- (void) unlockAchievementForHistory: (GameHistory*) hist;

- (void) unlockAchievementForRemovedBlocks: (NSInteger) numRemoved wildCards: (NSInteger) numWild;

+ (OFHandler*) singleton;

@end</pre>
<h3>OFHandler.mm</h3>
<pre>// A snippet of one of the calls. The #defines were auto generated by the OF site.
/**
 * This should be called upon every game over and checks the number of blocks remaining achievements.
 */
- (void) unlockAchievementForRemaining: (NSInteger) remaining colorCount: (GameMode) colorMode
{
 switch (remaining)
 {
   case 6:
     [OFAchievementService unlockAchievement:NO_BONUS_FOR_YOU_];
     break;
   case 5:
     [OFAchievementService unlockAchievement:FINALLY_A_BONUS_];
     break;
   case 4:
     [OFAchievementService unlockAchievement:OOOH_A_BIGGER_BONUS];
     break;
   ...
 }
 ...
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/12/01/openfeint-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Tests for the iPhone</title>
		<link>http://www.mycodestudio.com/blog/2009/08/02/38/</link>
		<comments>http://www.mycodestudio.com/blog/2009/08/02/38/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 14:29:38 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=38</guid>
		<description><![CDATA[Notes on one way to run iPhone Unit Tests.]]></description>
			<content:encoded><![CDATA[<p>In XCode 3.0 (not sure when they added it), there are options to add Unit Tests to your iPhone application but I was not able to get this to work properly using the <strong>iPhone</strong> Unit Test target. However I did find a <a href="http://www.mobileorchard.com/ocunit-integrated-unit-testing-in-xcode/">reference</a> to add <strong>Cocoa</strong> Unit Tests to your iPhone project. If you follow the link, you will find all the information you need. It's quick to add to your project and will allow your tests to run every time you build.</p>
<p><span id="more-38"></span></p>
<h3>Google Framework</h3>
<p>After some further work, the above setup allows easy running of unit tests. However, debugging those Unit Tests is another story. I found another <a href="http://www.luisdelarosa.com/2009/02/17/is-iphone-unit-testing-possible/">page</a> that walks<br />
through using the Google Toolkit for Mac to do unit testing. This allows you to run the unit tests as an executable and at least output console output (still can't seem to debug it). Note that with this framework, you need to set the active executable to your Testing executable in order to run. Any NSLog calls will be output to the console.</p>
<h3>Unit Test Assertions</h3>
<p>The table below is a quick reference to the different types of assertions that can be done in the UnitTest.</p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th scope="col">OCUnit Macro</th>
<th scope="col">Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td>STAssertNil(a1, description, ...)</td>
<td>Generates an error if a1 is not nil.</td>
</tr>
<tr>
<td>STAssertNotNil(a1, description, ...)</td>
<td>Generates an error if a1 is nil.</td>
</tr>
<tr>
<td>STAssertTrue(expression, description, ...)</td>
<td>Generates an error if expression does not evaluate to true</td>
</tr>
<tr>
<td>STAssertFalse(expression, description, ...)</td>
<td>Generates an error if expression does not evaluate to false</td>
</tr>
<tr>
<td>STAssertEqualObjects(a1, a2, description, ...)</td>
<td>Generates an error if a1 is not equal to a2. Both must be Objective-C objects.</td>
</tr>
<tr>
<td>STAssertEquals(a1, a2, description, ...)</td>
<td>Generates an error if a1 is not equal to a2. Both must be C scalar values.</td>
</tr>
<tr>
<td>STAssertEqualsWithAccuracy(left, right, accuracy, description, ...)</td>
<td>Generates an error if a1 and a2 are not within a certain amount of each other. Primarily for use with floats and doubles to take into account small rounding errors due to the way they store values.</td>
</tr>
<tr>
<td>STAssertThrows(expression, description, ...)</td>
<td>Generates an error if expression does not throw an exception.</td>
</tr>
<tr>
<td>STAssertThrowsSpecific(expression, specificException, description, ...)</td>
<td>Generates an error if expression does not throw an exception of a specified class.</td>
</tr>
<tr>
<td>STAssertThrowsSpecificNamed(expr, specificException, aName, description, ...)</td>
<td>Generates an error if expression doesn’t throw an exception with a specific name.</td>
</tr>
<tr>
<td>STAssertNoThrow(expression, description, ...)</td>
<td>Generates an error if expression throws an exception.</td>
</tr>
<tr>
<td>STAssertNoThrowSpecific(expression, specificException, description, ...)</td>
<td>Generates an error if expression throws an exception of a specified class.</td>
</tr>
<tr>
<td>STAssertNoThrowSpecificNamed(expr, specificException, aName, description, ...)</td>
<td>Generates an error if expression throws an exception with a specific name.</td>
</tr>
<tr>
<td>STFail(description, ...)</td>
<td>Generates an error.</td>
</tr>
<tr>
<td>STAssertTrueNoThrow(expression, description, ...)</td>
<td>Generates an error if expression is false or if it throws an exception.</td>
</tr>
<tr>
<td>STAssertFalseNoThrow(expron, description, ...)</td>
<td>Generates an error if expression is true or if it throws an exception</td>
</tr>
</tbody>
</table>
<p style="text-align: center;"><strong>Table 1:</strong> Macros Available in OCUnit from <a href="http://developer.apple.com/mac/articles/tools/unittestingwithxcode3.html">Apple</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/08/02/38/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Hashes</title>
		<link>http://www.mycodestudio.com/blog/2009/08/02/secure-hashes/</link>
		<comments>http://www.mycodestudio.com/blog/2009/08/02/secure-hashes/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 14:01:26 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=28</guid>
		<description><![CDATA[Code to execute the SHA-1 hash over an NSString and output a hex-encoded NSString.]]></description>
			<content:encoded><![CDATA[<p>If your application requires generation of secure hashes, you can use the raw Crypto APIs. These are actually C calls and do not have nice Objective C objects to interface with. The code snippet below shows how this is done for SHA-1. The input is any NSString and the output is a hex-encoded NSString version of the hashcode. If you need other types of hashing besides SHA-1, then you will need to change the SHA1 names in the functions and constants.</p>
<p><span id="more-28"></span></p>
<pre>+ (NSString*) getHash:(NSString *) text
{
    NSData* myData =
         [text dataUsingEncoding:NSStringEncodingConversionAllowLossy];
    CC_SHA1_CTX ctx;
    uint8_t * hashBytes = NULL;
    NSData * hash = nil;

   <span style="color: #008000;"> // Malloc a buffer to hold hash.</span>
    hashBytes = malloc( CC_SHA1_DIGEST_LENGTH * sizeof(uint8_t) );
    memset((void *)hashBytes, 0x0, CC_SHA1_DIGEST_LENGTH);

    <span style="color: #008000;">// Initialize the context.</span>
    CC_SHA1_Init(&amp;ctx);
    <span style="color: #008000;">// Perform the hash.</span>
    CC_SHA1_Update(&amp;ctx, (void *)[myData bytes], [myData length]);
    <span style="color: #008000;">// Finalize the output.</span>
    CC_SHA1_Final(hashBytes, &amp;ctx);

    <span style="color: #008000;">// Build up the SHA1 data.</span>
    hash = [NSData dataWithBytes:(const void *)hashBytes
                          length:(NSUInteger)CC_SHA1_DIGEST_LENGTH];

    <span style="color: #008000;">// if could not create, then exit otherwise clean up</span>
    if(hashBytes)
      free(hashBytes);
    else
      return nil;

    <span style="color: #008000;">// now return this as an hex-encoded string</span>
    NSMutableString *stringBuffer = [NSMutableString
                                     stringWithCapacity:([hash length] * 2)];
    const unsigned char *dataBuffer = [hash bytes];
    int i;
    for (i = 0; i &lt; [hash length]; ++i)
    {
        [stringBuffer appendFormat:@"%02X", (unsigned long)dataBuffer[i]];
    }

    return [[stringBuffer copy] autorelease];
}</pre>
<p>One thing to note is the you need to include the following line:</p>
<pre>#import &lt;CommonCrypto/CommonDigest.h&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/08/02/secure-hashes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Let There Be Lite</title>
		<link>http://www.mycodestudio.com/blog/2009/07/30/let-there-be-light/</link>
		<comments>http://www.mycodestudio.com/blog/2009/07/30/let-there-be-light/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 04:03:22 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=11</guid>
		<description><![CDATA[Learn how to easily create a Lite or Free version of your application with XCode project settings.]]></description>
			<content:encoded><![CDATA[<p>Creating a Lite or Free version (don't call it a 'Demo' on the App Store) of your application is  pretty easy to do assuming there your application can support reduced functionality. One way you could do this is just copy your whole project and start modifying your code to make it Lite. The biggest drawback to this is the dual maintenance of code if you have to fix a bug in both the full and Lite versions. The alternative is to create a new target in the same XCode project with different settings. This is the approach I took with Flik.</p>
<p>Fortunately for me, a Lite version of Flik translates into providing just a few levels instead of the full set of levels and so I could focus on those changes.The steps below outline what was done.<span id="more-11"></span></p>
<h3>Change Your Code</h3>
<p>Where your Lite version differs from the full version at the code level, you should add #ifdef areas that are applicable to the Lite version versus the full version. While you can do an explicit #define in your code and change this before compilation, see the 'XCode Build Settings' below to see how to have XCode do this for you.</p>
<p><code>#ifdef LITE<br />
<span style="color: #008000;">// LITE logic goes here</span><br />
#else<br />
<span style="color: #008000;">// FULL logic does here</span><br />
#endif</code></p>
<blockquote><p>To test that your targets are setup correctly, add this code somewhere:<br />
<code>#ifndef LITE<br />
#error "Not Lite"<br />
#endif <span style="color: #008000;">// LITE</span></code></p>
<p style="text-align: left;">That will cause your build to FAIL on all non-Lite builds, and SUCCEED (assuming no other compile issues) on all Lite builds.   -<a href="http://neonscape.net/">William</a> (from <a href="https://devforums.apple.com/message/31039#31039">Apple Forums</a>)</p>
</blockquote>
<h3>Copy Your Target</h3>
<p>In XCode, expand the Targets item and select your application. Right click and say duplicate. At this point you probably should rename this to end in 'Lite' or 'Free'. You may want to rename the Info.plist file as well.</p>
<p><img src="/images/devLite04.png" alt="Show Targets" width="284" /></p>
<h3>XCode Build Settings</h3>
<p>For each Build Configuration that you need (e.g. Debug, Debug Device, Device Ad Hoc Distribution, Device App Store Distribution), you need to change the following settings for the Lite version. This can be found on the Build tab of the Project Settings for your Lite Target (select your target and then select the Project &gt; Edit Active Target ... Lite).</p>
<ul>
<li>Info.plist File</li>
<li>Product Name</li>
</ul>
<blockquote><p>You can actually specify "Configuration: All Configurations" in the top left of that screen to avoid the hassle of doing this multiple times. -<a href="http://neonscape.net/">William</a> (from <a href="https://devforums.apple.com/message/31039#31039">Apple Forums</a>)</p></blockquote>
<p><img src="/images/devLite02.png" alt="XCode Settings" width="625" /></p>
<p>One other item to change on this tab is the Preprocessor Macro. This is the same as doing a #define in your code. See the section aboe on where this can be used in code.</p>
<p><img src="/images/devLite01.png" alt="Macros" width="626" /></p>
<h3>XCode Properties Settings</h3>
<p>If you add a space in your product name, this causes an issue in the Identifier field on the Properties tab. This normally starts out with: com.yourcompany.${PRODUCT_NAME:identifier}. If your name is 'App Lite', then this will fail during the upload process to Apple. You should explicitly set this to something unique, following Apple's recommended scheme.</p>
<p><img src="/images/devLite03.png" alt="Macros" width="649" /></p>
<p>While you are on this screen, you should change the Icon File to the file you will create next.</p>
<h3>Graphics and Other Files</h3>
<div class="figure57a"><img src="/images/IconLite.png" alt="Flik Lite" width="57" align="right" /></div>
<p>You should create a different icon to be displayed on the App Store. The simple way to do this is just add the word 'Lite' to it. You should make sure that this icon is added to just your Lite target and not your full target. Conversely, you should also make sure the Lite icon is <strong>not</strong> in the full target.</p>
<p><img src="/images/devLite05.png" alt="targets" width="372" /></p>
<p>You should do this with all the other images or files that should be in one version and not another. You also need to prepare other images for the iTunes App Store.<br />
That should be it. At this point you should be able to build both your full and Lite versions of your application easily. Just change the Active Target before you build.</p>
<address style="text-align: center;">Note: This was taken from the <a href="/devnotes.html">original page</a> and posted to this blog.</address>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/07/30/let-there-be-light/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Welcome Post</title>
		<link>http://www.mycodestudio.com/blog/2009/07/29/welcome-post/</link>
		<comments>http://www.mycodestudio.com/blog/2009/07/29/welcome-post/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 03:19:44 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=3</guid>
		<description><![CDATA[Welcome to the myCodeStudio blog! This will replace the Developer Notes section.]]></description>
			<content:encoded><![CDATA[<p>Welcome to the myCodeStudio blog! For the most part, this will replace the Developer Notes section on the current website. That content will be moved over onto the blog, but those pages will still remain accessible for anyone linking to them <a href="/devnotes.html">here</a> . We will eventually shift this blog and the main myCodeStudio site to have a common theme.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/07/29/welcome-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
