<?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; iPhone</title>
	<atom:link href="http://www.chrisdanielson.com/tag/iphone/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>Unity3D File Based Assetbundles on the iPhone</title>
		<link>http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/</link>
		<comments>http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/#comments</comments>
		<pubDate>Tue, 03 May 2011 21:37:11 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[Unity3D]]></category>
		<category><![CDATA[assetbundle]]></category>
		<category><![CDATA[AssetBundleRequest]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[prefab]]></category>
		<category><![CDATA[UnityEditor]]></category>
		<category><![CDATA[UnityEngine]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=460</guid>
		<description><![CDATA[Developing assetbundles for the Unity3D engine seems to be a troubling case.  I'm going to try and make this a little a little easier than it typically is in my simple tutorial on how to do it.]]></description>
			<content:encoded><![CDATA[<p>Let me start off by saying that Unity3D is a really great game engine.  Let me also say that I wish the documentation was as great as the engine is.  Sadly, it&#8217;s difficult to figure out some of the more powerful features of Unity3D without significant trial and error.</p>
<p><em>Please note, that I have read that the usage of Assetbundles on the iPhone can be memory intensive and may or may not fit your needs per your project.  I am just putting this information here so that others can see how to do this.</em>  <strong>Pro Tip</strong>: What this means to you?  Profile the heck out of your code, pre-assetbundles and after integrating assetbundles.  </p>
<p>Assumptions:<br />
1.  You know or are familiar Unity3D 3.3.<br />
2.  You can code in C#.<br />
3.  You&#8217;re an ace at creating prefabs in Unity.<br />
4.  You&#8217;re using Unity3D 3.3 Pro and iOS Pro.</p>
<p>OK, if you&#8217;re still feeling good, let&#8217;s bounce into this how-to.</p>
<h3>Create the Project</h3>
<h3><span style="font-weight: normal; font-size: 13px;">Open up a new project in Unity3D and set it up for &#8220;iPhone&#8221; iOS.  Feel free to name it whatever passes your way.</span></h3>
<p><span style="font-weight: normal; font-size: 13px;">In the <strong>project</strong> hierarchy, let&#8217;s go ahead and create a simple directory structure as follows:</span><br />
<a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.08.08-PM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.08.08-PM.png" alt="" title="Screen shot 2011-05-03 at 1.08.08 PM" width="253" height="228" class="alignright size-full wp-image-466" /></a><br />
/Example Project/<br />
/Example Project/iphone/<br />
/Example Project/iphone/objects/<br />
/Example Project/iphone/materials/</p>
<p>Hit save after doing this and save your default scene and name it whatever you want.  In my case, I named it &#8220;test&#8221;.</p>
<p>Though, this is a near complete looking example (image to the right), the basic structure should look like the image to the right here.</p>
<p>Add at least one prefab to your project.  I have added two prefabs here, &#8220;box&#8221; and &#8220;ABCD&#8221;.  Both are just tests and contain a cube prefab with a simple texture applied.  Make sure that the materials referenced by your prefabs have the following attributes.  1.  They are named the same as the prefab.  (See the image above!).  2.  They are stored in the materials folder underneath the iphone folder.</p>
<h3>UnityEditor Coding Time</h3>
<p>When working on assetbundles, the first thing you have to do is generate them.  Unfortunately, Unity3D does not have anything built in for generating these files except for a UnityEditor API.  The UnityEditor script can only be run from inside the Unity3D editor tool.  It typically appears as a menu item after the script has been successfully compiled.  So if you can code, then you&#8217;re in good shape.  </p>
<p>Let&#8217;s create the UnityEditor script.  Create a new C-Sharp script in a <strong>/Plugins/</strong> folder (create it if it doesn&#8217;t already exist) at the root of your project and name it <em>MPCreateAssetBundle</em>.  Copy and paste the following into it.  <em>Please note: some of this code was borrowed from Unity&#8217;s own Character Customization tutorial on their website</em>.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p460code1'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4601"><td class="code" id="p460code1"><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: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">UnityEditor</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">UnityEngine</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Object</span><span style="color: #008000;">=</span>UnityEngine<span style="color: #008000;">.</span><span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> MPCreateAssetBundle <span style="color: #008000;">:</span> MonoBehaviour <span style="color: #008000;">&#123;</span>
&nbsp;
	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> mpAssetDir <span style="color: #008000;">=</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;">String</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#123;</span><span style="color: #666666;">&quot;iphone&quot;</span>, <span style="color: #666666;">&quot;ipad&quot;</span>, <span style="color: #666666;">&quot;macosx&quot;</span>, <span style="color: #666666;">&quot;pc&quot;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span><span style="color: #008080; font-style: italic;">// , &quot;universal&quot;}; &lt;-- not needed, use the /Resources/ folder.</span>
&nbsp;
	<span style="color: #008000;">&#91;</span>MenuItem<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Custom/Monkey Prism/Create All Assetbundles #&amp;i&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Execute<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Creating Assetbundles&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #6666cc; font-weight: bold;">bool</span> blnFound <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
		<span style="color: #6666cc; font-weight: bold;">String</span> currentDir <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">Object</span> o <span style="color: #0600FF; font-weight: bold;">in</span> Selection<span style="color: #008000;">.</span><span style="color: #0000FF;">GetFiltered</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&#41;</span>, SelectionMode<span style="color: #008000;">.</span><span style="color: #0000FF;">DeepAssets</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			blnFound <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>o<span style="color: #008000;">.</span><span style="color: #0000FF;">name</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;@&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">continue</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//animations!</span>
			<span style="color: #6666cc; font-weight: bold;">String</span> assetPath <span style="color: #008000;">=</span> AssetDatabase<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAssetPath</span><span style="color: #008000;">&#40;</span>o<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><span style="color: #008000;">!</span>File<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>assetPath<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				currentDir <span style="color: #008000;">=</span> assetPath<span style="color: #008000;">;</span>
				<span style="color: #0600FF; font-weight: bold;">continue</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Files only.</span>
			<span style="color: #008000;">&#125;</span>
			<span style="color: #008080; font-style: italic;">//Only check those directories that we have specified in the mpAssetDir</span>
			Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span>assetPath<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #6666cc; font-weight: bold;">String</span> currentBuildType <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
			<span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">String</span> s <span style="color: #0600FF; font-weight: bold;">in</span> mpAssetDir<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>assetPath<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/&quot;</span><span style="color: #008000;">+</span>s<span style="color: #008000;">+</span><span style="color: #666666;">&quot;/&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
					currentBuildType <span style="color: #008000;">=</span> s<span style="color: #008000;">;</span>
					<span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>currentBuildType <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">continue</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//if the directory is not found to be one from the mpAssetDir bail out.</span>
&nbsp;
			<span style="color: #6666cc; font-weight: bold;">string</span> assetBundleName <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span>, genericName <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
			List<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&gt;</span> toinclude <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> List<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">//Generate pre-fabs for everything in the finished pre-fab directory.</span>
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>o<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span>GameObject<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;GameObject &quot;</span> <span style="color: #008000;">+</span> currentDir<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
				<span style="color: #6666cc; font-weight: bold;">String</span> d <span style="color: #008000;">=</span> CharacterRoot<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>GameObject<span style="color: #008000;">&#41;</span>o<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				d <span style="color: #008000;">+=</span> <span style="color: #666666;">&quot;materials/&quot;</span><span style="color: #008000;">;</span>
				Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span>d<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				List<span style="color: #008000;">&lt;</span>Material<span style="color: #008000;">&gt;</span> materials <span style="color: #008000;">=</span> CollectAll<span style="color: #008000;">&lt;</span>Material<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>d<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;materials count=&quot;</span> <span style="color: #008000;">+</span> materials<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
				genericName <span style="color: #008000;">=</span> o<span style="color: #008000;">.</span><span style="color: #0000FF;">name</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToLower</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				assetBundleName <span style="color: #008000;">=</span> currentBuildType <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;-prefab-&quot;</span> <span style="color: #008000;">+</span> genericName<span style="color: #008000;">;</span>
				<span style="color: #008080; font-style: italic;">//Package up the prefabs in the iPhone directory.</span>
				toinclude<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>o<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #008080; font-style: italic;">//Do we need to add in a material?  I think so.</span>
				<span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>Material m <span style="color: #0600FF; font-weight: bold;">in</span> materials<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
					Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Material Name=&quot;</span> <span style="color: #008000;">+</span> m<span style="color: #008000;">.</span><span style="color: #0000FF;">name</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>m<span style="color: #008000;">.</span><span style="color: #0000FF;">name</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>genericName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
						toinclude<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>m<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
						Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Added a new material!&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
					<span style="color: #008000;">&#125;</span>
				<span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//end foreach</span>
&nbsp;
			<span style="color: #008000;">&#125;</span> 
&nbsp;
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>assetBundleName <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">continue</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp;
			<span style="color: #008080; font-style: italic;">// Create a directory to store the generated assetbundles.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>AssetbundlePath<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateDirectory</span><span style="color: #008000;">&#40;</span>AssetbundlePath<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Delete existing assetbundles for current object</span>
            <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> existingAssetbundles <span style="color: #008000;">=</span> Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">GetFiles</span><span style="color: #008000;">&#40;</span>AssetbundlePath<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> bundle <span style="color: #0600FF; font-weight: bold;">in</span> existingAssetbundles<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>bundle<span style="color: #008000;">.</span><span style="color: #0000FF;">EndsWith</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;.assetbundle&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span> bundle<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/assetbundles/&quot;</span> <span style="color: #008000;">+</span> assetBundleName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    File<span style="color: #008000;">.</span><span style="color: #0000FF;">Delete</span><span style="color: #008000;">&#40;</span>bundle<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">//Directories expected.</span>
			Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;currentBuildType = &quot;</span> <span style="color: #008000;">+</span> currentBuildType<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
			<span style="color: #008080; font-style: italic;">//path = AssetbundlePath + bundleName + &quot;.assetbundle&quot;;</span>
			<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>toinclude<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</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: #6666cc; font-weight: bold;">String</span> path <span style="color: #008000;">=</span> AssetbundlePath <span style="color: #008000;">+</span> assetBundleName <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.assetbundle&quot;</span><span style="color: #008000;">;</span>
				Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span>path<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>currentBuildType<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span>mpAssetDir<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> currentBuildType<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span>mpAssetDir<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">//iPhone &amp; iPad</span>
					BuildPipeline<span style="color: #008000;">.</span><span style="color: #0000FF;">BuildAssetBundle</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, toinclude<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, path, BuildAssetBundleOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">CollectDependencies</span>, BuildTarget<span style="color: #008000;">.</span><span style="color: #0000FF;">iPhone</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
				<span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #008080; font-style: italic;">//TODO: might need to condition further and might want to use an enum with the conditional.</span>
					BuildPipeline<span style="color: #008000;">.</span><span style="color: #0000FF;">BuildAssetBundle</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, toinclude<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, path, BuildAssetBundleOptions<span style="color: #008000;">.</span><span style="color: #0000FF;">CollectDependencies</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
		<span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//end foreach</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>blnFound<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;no objects were found for building assets with.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>	
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> AssetbundlePath
    <span style="color: #008000;">&#123;</span>
        get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #666666;">&quot;assetbundles&quot;</span> <span style="color: #008000;">+</span> Path<span style="color: #008000;">.</span><span style="color: #0000FF;">DirectorySeparatorChar</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// This method loads all files at a certain path and</span>
    <span style="color: #008080; font-style: italic;">// returns a list of specific assets.</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> List<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> CollectAll<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> path<span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">where</span> T <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">Object</span>
    <span style="color: #008000;">&#123;</span>
        List<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> l <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> List<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> files <span style="color: #008000;">=</span> Directory<span style="color: #008000;">.</span><span style="color: #0000FF;">GetFiles</span><span style="color: #008000;">&#40;</span>path<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> file <span style="color: #0600FF; font-weight: bold;">in</span> files<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>file<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;.meta&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">continue</span><span style="color: #008000;">;</span>
            T asset <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span> AssetDatabase<span style="color: #008000;">.</span><span style="color: #0000FF;">LoadAssetAtPath</span><span style="color: #008000;">&#40;</span>file, <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</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>asset <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Asset is not &quot;</span> <span style="color: #008000;">+</span> <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;: &quot;</span> <span style="color: #008000;">+</span> file<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            l<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>asset<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> l<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>	
	<span style="color: #008080; font-style: italic;">// Returns the path to the directory that holds the specified FBX.</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> CharacterRoot<span style="color: #008000;">&#40;</span>GameObject character<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> root <span style="color: #008000;">=</span> AssetDatabase<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAssetPath</span><span style="color: #008000;">&#40;</span>character<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> root<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, root<span style="color: #008000;">.</span><span style="color: #0000FF;">LastIndexOf</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'/'</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Once this is completed, you&#8217;ll want to do two things.<br />
1.  Select (by moving your mouse over and left-clicking on it once) the <strong>iphone</strong> folder under &#8220;Example Project&#8221;.<br />
2.  Run the script as shown in the image:  <a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.45.19-PM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.45.19-PM.png" alt="" title="Screen shot 2011-05-03 at 1.45.19 PM" width="647" height="115" class="alignnone size-full wp-image-480" /></a></p>
<p>So let&#8217;s back up for a second and look at what we just did.  We created a project, created some folders within the project, placed prefabs into the iphone folder and created a UnityEditor script.  Upon running this script, a new directory named &#8220;assetbundles&#8221; would be created.<br />
<a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.56.22-PM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-1.56.22-PM.png" alt="" title="Screen shot 2011-05-03 at 1.56.22 PM" width="448" height="236" /></a><br />
This directory is not going to be visible to you until you open finder (on Mac) or explorer (on Windows) as it is located on the file system.  (see the image above).  Inside this folder you should see your prefab(s) named now as:  <em>iphone-prefab-&lt;my prefab name&gt;.assetbundle</em>.  If you are seeing this, congratulations, you&#8217;ve now created your own assetbundles uniquely per prefab.</p>
<h3>Generic GameObject and a Simple Script</h3>
<p>If you&#8217;ve come this far, great work!  We&#8217;re nearly done.<br />
Let&#8217;s create a new GameObject under the <strong>Hierarchy</strong>. </p>
<p>Now we&#8217;re going to write a simple script to instantiate the assetbundles we assembled earlier.  Create a new C-Sharp script in the <strong>/Plugins/</strong> folder and name it &#8220;Example&#8221;.  Copy and paste the following code into it:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p460code2'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4602"><td class="code" id="p460code2"><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: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">UnityEngine</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Example <span style="color: #008000;">:</span> MonoBehaviour <span style="color: #008000;">&#123;</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> WWW www<span style="color: #008000;">;</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> AssetBundleRequest gameObjectRequest<span style="color: #008000;">;</span>	
	<span style="color: #008080; font-style: italic;">// Use this for initialization</span>
	IEnumerator Start <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">//TODO: change the name of the file below!!!</span>
		<span style="color: #6666cc; font-weight: bold;">String</span> strPath <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;file://&quot;</span> <span style="color: #008000;">+</span> Application<span style="color: #008000;">.</span><span style="color: #0000FF;">dataPath</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;/../assetbundles/iphone-prefab-box.assetbundle&quot;</span><span style="color: #008000;">;</span>
		Debug<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">&#40;</span>strPath<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		www <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> WWW<span style="color: #008000;">&#40;</span>strPath<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF; font-weight: bold;">yield</span> <span style="color: #0600FF; font-weight: bold;">return</span> www<span style="color: #008000;">;</span>
        <span style="color: #008080; font-style: italic;">/* TODO: change the name &quot;Box&quot; to match the name of your prefab that you compiled into the assetbundle on step 1. */</span>
		AssetBundleRequest request <span style="color: #008000;">=</span> www<span style="color: #008000;">.</span><span style="color: #0000FF;">assetBundle</span><span style="color: #008000;">.</span><span style="color: #0000FF;">LoadAsync</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Box&quot;</span>, <a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span>GameObject<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF; font-weight: bold;">yield</span> <span style="color: #0600FF; font-weight: bold;">return</span> request<span style="color: #008000;">;</span>
		Instantiate<span style="color: #008000;">&#40;</span>request<span style="color: #008000;">.</span><span style="color: #0000FF;">asset</span>, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Vector3<span style="color: #008000;">&#40;</span>3f, 0f, 0f<span style="color: #008000;">&#41;</span>, Quaternion<span style="color: #008000;">.</span><span style="color: #0000FF;">identity</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		Instantiate<span style="color: #008000;">&#40;</span>request<span style="color: #008000;">.</span><span style="color: #0000FF;">asset</span>, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Vector3<span style="color: #008000;">&#40;</span>0f, 0f, 0f<span style="color: #008000;">&#41;</span>, Quaternion<span style="color: #008000;">.</span><span style="color: #0000FF;">identity</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		Instantiate<span style="color: #008000;">&#40;</span>request<span style="color: #008000;">.</span><span style="color: #0000FF;">asset</span>, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Vector3<span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span>3f, 0f, 0f<span style="color: #008000;">&#41;</span>, Quaternion<span style="color: #008000;">.</span><span style="color: #0000FF;">identity</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		www<span style="color: #008000;">.</span><span style="color: #0000FF;">assetBundle</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Unload</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #008000;">&#125;</span>
        <span style="color: #6666cc; font-weight: bold;">void</span> Update<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>NOTE:</strong> Make sure to change the TODO line in the code to match your file name!  If you don&#8217;t do this, it might not work!</p>
<p>We&#8217;re nearly done!  Drag your Example.cs script onto the GameObject you created earlier.  Here is how my project looks:<br />
<a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-2.16.03-PM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-2.16.03-PM.png" alt="" title="Screen shot 2011-05-03 at 2.16.03 PM" width="750" height="367" class="alignnone size-full wp-image-493" /></a></p>
<h3>Build Time</h3>
<p>We&#8217;re now going to build this codebase so that you can run it on your iOS device for testing.  I&#8217;m going to skip the painful steps of creating a code signing certificate and all that jazz.  We&#8217;re instead going to focus on how to get the actual assetbundle onto your iOS device in an area that will be accessible to the &#8220;Application.dataPath&#8221; call in your code!  </p>
<p>1.  Build the Unity project for iOS.<br />
2.  XCode should automatically open.<br />
3.  Within XCode you are going to need to tell it about your assetbundles folder!  Open up finder or explorer and locate the assetbundles folder that was generated by the UnityEditor script we discussed earlier.<br />
4.  Drag and drop the assetbundles folder into XCode at the root of the iOS project.  (You should see a prompt as follows)<br />
<a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-10.53.56-AM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-10.53.56-AM.png" alt="" title="Screen shot 2011-05-03 at 10.53.56 AM" width="739" height="545" class="alignnone size-full wp-image-496" /></a></p>
<p>5.  Click &#8220;Finish&#8221;.  </p>
<p>This will then look something like this:<br />
<a href="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-2.24.30-PM.png"><img src="http://www.chrisdanielson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-03-at-2.24.30-PM.png" alt="" title="Screen shot 2011-05-03 at 2.24.30 PM" width="256" height="157" class="alignnone size-full wp-image-497" /></a></p>
<p>6.  Build the code using XCode and run it on your iOS device.</p>
<p>If everything works properly, you should see one of the prefabs instantiate on your iOS screen.  That is all there is to it!  I think you&#8217;ll find that this isn&#8217;t as bad as one might imagine, but it does require some serious fishing around in code examples and heavily crawling the Unity forums.  The only way I figured this out was by trial and error, heavy amounts of Debug.Log calls and 3 pots of coffee.  I&#8217;m now going to go and grind my teeth on my level editor.</p>
<p>Edit:  I have one of my original forum posts here as well regarding this issue.  <a href="http://forum.unity3d.com/threads/87892-Failed-to-load-asset-bundle">Unity3D Forum</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2011/05/03/unity3d-file-assetbundles-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>iPhone users able to build a shinier world, one turd at a time</title>
		<link>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/</link>
		<comments>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:27:16 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod touch]]></category>
		<category><![CDATA[Polish It]]></category>
		<category><![CDATA[Turd Polishing]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=365</guid>
		<description><![CDATA[Turd Polishing has hit the iPhone with a splatter.]]></description>
			<content:encoded><![CDATA[<p>This blog usually focuses on software development, but I can&#8217;t  resist sharing this with all of you out there.  Have a good laugh!</p>
<p><strong>MaxPowerSoft Puts a New Polish on an Old Adage: You Actually Can  Polish a Turd</strong></p>
<p><object width="425" height="355" type="application/x-shockwave-flash" data="http://www.youtube.com/v/6kZxC1WCk3Y"><param name="movie" value="http://www.youtube.com/v/6kZxC1WCk3Y" />This video was embedded using the YouTuber plugin by <a href="http://www.roytanck.com">Roy Tanck</a>. Adobe Flash Player is required to view the video.</object></p>
<p>&#8216;<strong><a href="http://itunes.apple.com/us/app/polish-it/id345199287?mt=8">Polish It</a>&#8216;</strong> now available at the iPhone App Store</p>
<p>SAN DIEGO, CA (May 24, 2010) &#8211; MaxPowerSoft (www.maxpowersoft.com) today announced the release of Polish It, an iPhone application designed to facilitate &#8220;a shinier world, one turd at a time&#8221;. Available for $0.99 at Apple&#8217;s iPhone App Store, ‘Polish It’ is both a literal and cute/comedic take on the old and well-known phrase “You can’t polish a turd”. Your goal is simple: Choose a turd you like, and polish it! Utilize the touchscreen and your finger for polishing, tilt the phone to maneuver, and snap a photo at anytime to share.</p>
<p>&#8220;We wanted to reach out and give frustrated workers, students, and really all curious people in general, the powerful ability to truly polish a turd,&#8221; says Nic Danielson, Director of Marketing. &#8220;MaxPowerSoft has created an innovative new technology that allows one to therapeutically accomplish the task of polishing turds in the palm of your hand, no matter where you are, and on a whim to boot &#8211; most importantly, it can be done without the need for any sanitization processes.  There really is nothing else like it in the market, or the world for that matter.&#8221;</p>
<p>Features of Polish It include:</p>
<ul>
<li>Objects rendered in full 3D.</li>
<li>Choose from over 10 objects to polish.</li>
<li>Simple controls: Touch to polish, Tilt phone to maneuver.</li>
<li>Snap a photo and send to your friends.</li>
<li>More features to come.</li>
</ul>
<p>Pricing and Availability:</p>
<p>Polish It is available for $0.99 at the iPhone App Store:</p>
<p><a href="http://itunes.apple.com/us/app/polish-it/id345199287?mt=8">http://itunes.apple.com/us/app/polish-it/id345199287?mt=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Could not send unregistration request to daemon</title>
		<link>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/</link>
		<comments>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 21:48:59 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[CLClientInvalidate]]></category>
		<category><![CDATA[CLClientRegister]]></category>
		<category><![CDATA[CLLocationManager]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=337</guid>
		<description><![CDATA[During a debug process have you seen any of the following lines in your debugger/console logs? void CLClientInvalidate(__CLClient*)",could not send unregistration request to daemon or&#8230; CLClientRegister: could not send registration request to daemon If so, you&#8217;ve probably already seen this Apple support link:  http://discussions.apple.com/message.jspa?messageID=8408930 Well, I&#8217;m just going to validate a few things here for [...]]]></description>
			<content:encoded><![CDATA[<p>During a debug process have you seen any of the following lines in your debugger/console logs?</p>
<pre>void CLClientInvalidate(__CLClient*)",could not send unregistration request to daemon</pre>
<p>or&#8230;</p>
<pre>CLClientRegister: could not send registration request to daemon</pre>
<p>If so, you&#8217;ve probably already seen this Apple support link:  <a href="http://discussions.apple.com/message.jspa?messageID=8408930">http://discussions.apple.com/message.jspa?messageID=8408930</a></p>
<p>Well, I&#8217;m just going to validate a few things here for you.  (Before continuing this&#8230; check your code after briefly reading <a href="http://blog.blackwhale.at/2010/08/error-clclientinvalidate-could-not-send-unregistration-request-to-daemon/">this blog</a>.</p>
<ol>
<li>You will have to <a href="http://support.apple.com/kb/HT1414">restore your iPhone</a>.  (This is the solution that worked for me).  Please post a comment if you find a better solution.</li>
<li>If you are coding using CLLocationManager you will more than likely notice that you only get 1 set of GPS values before the message starts appearing.  Also, the CLLocationManager startUpdatingLocation method will only call your delegate once.  (That is what was happening on my iPhone).</li>
<li>If you dig through your iPhones &#8220;crash logs&#8221; via the Organizer application, you&#8217;ll more than likely witness that many applications are crashing.</li>
</ol>
<p>I tried a multitude of workarounds and the only thing that sadly worked was a &#8220;restore&#8221; which took over 1 hour to complete.  I will say this, my iPhone runs a lot faster now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Apple iPhone Web Kit with Activity Indicator</title>
		<link>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/</link>
		<comments>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 16:38:43 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UIActivityIndicatorView]]></category>
		<category><![CDATA[UIWebView]]></category>
		<category><![CDATA[Web Kit]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=290</guid>
		<description><![CDATA[Welcome to the club of searching for an overly simple UIWebView a.k.a. WebKit example! In this example, I&#8217;ll show you simply how to hand code a quick UIWebView into your program as well as to add a UIActivityIndicatorView a.k.a. an activity indicator. Without jabbing Apple too hard here, the documentation is pretty bad and that [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to the club of searching for an overly simple UIWebView a.k.a. WebKit example!  In this example, I&#8217;ll show you simply how to hand code a quick UIWebView into your program as well as to add a UIActivityIndicatorView a.k.a. an activity indicator.  Without jabbing Apple too hard here, the documentation is pretty bad and that is why it&#8217;s nice to have an example just shown to you as-is.  I hope this example helps shine a light on the situation for anyone wanting to implement a nice and quick Apple iPhone WebKit solution.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p290code5'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2905"><td class="code" id="p290code5"><pre class="objc" style="font-family:monospace;">&nbsp;
<span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> FirstViewController <span style="color: #002200;">:</span> UIViewController &lt;UIWebViewDelegate&gt;
<span style="color: #002200;">&#123;</span>
	UIWebView <span style="color: #002200;">*</span>myWebView;
	UIActivityIndicatorView <span style="color: #002200;">*</span>activityIndicator;	
<span style="color: #002200;">&#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('p290code6'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2906"><td class="code" id="p290code6"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">/*
Inside the @implementation FirstViewController ... 
*/</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span> <span style="color: #11740a; font-style: italic;">//We have a NIB file in play here, so I dropped the loadView here.  Just make sure that your loadView is not getting called twice!</span>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self loadView<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span>
	UIView <span style="color: #002200;">*</span>contentView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
	self.view <span style="color: #002200;">=</span> contentView;	
&nbsp;
	CGRect webFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span>;
	webFrame.origin.y <span style="color: #002200;">=</span> 0.0f;
	myWebView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIWebView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>webFrame<span style="color: #002200;">&#93;</span>;
	myWebView.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor blueColor<span style="color: #002200;">&#93;</span>;
	myWebView.scalesPageToFit <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
	myWebView.autoresizingMask <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight<span style="color: #002200;">&#41;</span>;
	myWebView.delegate <span style="color: #002200;">=</span> self;
	<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span> myWebView<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView loadRequest<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.maxpowersoft.com/&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	activityIndicator <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActivityIndicatorView alloc<span style="color: #002200;">&#93;</span>initWithActivityIndicatorStyle<span style="color: #002200;">:</span>UIActivityIndicatorViewStyleGray<span style="color: #002200;">&#93;</span>;
	activityIndicator.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">40.0</span>, <span style="color: #2400d9;">40.0</span><span style="color: #002200;">&#41;</span>;
	activityIndicator.center <span style="color: #002200;">=</span> self.view.center;
	<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span> activityIndicator<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>activityIndicator release<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView release<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #6e371a;">#pragma mark WEBVIEW Methods</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webViewDidStartLoad<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// starting the load, show the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
	<span style="color: #002200;">&#91;</span>activityIndicator startAnimating<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webViewDidFinishLoad<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// finished loading, hide the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
	<span style="color: #002200;">&#91;</span>activityIndicator stopAnimating<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView didFailLoadWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span style="color: #400080;">NSError</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// load error, hide the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// report the error inside the webview</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a><span style="color: #002200;">*</span> errorString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithFormat<span style="color: #002200;">:</span>
							 <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;html&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size=+5 color='red'&gt;Error&lt;br /&gt;&lt;br /&gt;Your request %@&lt;/font&gt;&lt;/center&gt;&lt;/html&gt;&quot;</span>,
							 error.localizedDescription<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView loadHTMLString<span style="color: #002200;">:</span>errorString baseURL<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>That is all there is to it.  It&#8217;s really simple as you can see.  Feel free to copy and paste accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Release iPhone/iPod Touch FreeSWITCH Console</title>
		<link>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/</link>
		<comments>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 15:17:43 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod touch]]></category>
		<category><![CDATA[MaxPowerSoft]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=163</guid>
		<description><![CDATA[Well, it has been a long battle.  Fought since June 5th, 2009, but at long last Apple has come through and allowed the FreeSWITCH Console application into the app store. FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8"><img class="alignleft size-full wp-image-180" title="fs_logo_57_57" src="http://www.chrisdanielson.com/wp-content/uploads/2009/08/fs_logo_57_57.png" alt="fs_logo_57_57" width="57" height="57" /></a> Well, it has been a long battle.  Fought since June 5th, 2009, but at long last Apple has come through and allowed the <a href="http://freeswitch.org">FreeSWITCH</a> Console application into the app store.</p>
<blockquote><p><span>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch.  It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </span></p></blockquote>
<p>So without much further ado, here is the iTunes link:  <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8">App Store, FreeSWITCH Console</a>.</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8"><img class="aligncenter size-full wp-image-178" title="FreeSWITCH Console Screenshot" src="http://www.chrisdanielson.com/wp-content/uploads/2009/08/photo.jpg" alt="FreeSWITCH Console Screenshot" width="320" height="480" /></a></p>
<p>The application requires that you have the <a href="http://wiki.freeswitch.org/wiki/Mod_event_socket">event socket layer (ESL)</a> module installed in your FreeSWITCH instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Apple App Store Scalability Issues and Subjective Rejections</title>
		<link>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/</link>
		<comments>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:24:45 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[3.3.14]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[Application Reviewer]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=94</guid>
		<description><![CDATA[I found a wonderful article by Craig Hockenberry regarding Apple&#8217;s big iPhone and App Store issue. This link says it all regarding the issues with Apple’s inability to keep developers happy. Whenever I think back to what put Microsoft atop the operating system market, the first thing that comes to mind is Microsoft’s support of [...]]]></description>
			<content:encoded><![CDATA[<p>I found a wonderful article by Craig Hockenberry regarding <a href="http://furbo.org/2009/07/10/year-two/">Apple&#8217;s big iPhone and App Store issue</a>.  This link says it all regarding the issues with Apple’s inability to keep developers happy. Whenever I think back to what put Microsoft atop the operating system market, the first thing that comes to mind is Microsoft’s support of the developers. Though many developers agree that the documentation for the Windows API isn’t all that great, it is there and Microsoft does support it. Also, Microsoft allows us to write what we want without any requirement to run our code through a quality control structure. Granted, this is perhaps the reason why there are so many viruses (and junk) written on Windows, but  this has also allowed developers to freely create innovative programs that enable Microsoft to still take a big piece of the operating system market.</p>
<p>Now having a quality control system in place such as Apple&#8217;s iPhone reviewers is a great idea because it prevents <a href="http://en.wikipedia.org/wiki/Malware">malware</a> from getting on your phone.  No one refutes that.  But as soon as you get wrapped into what and how they are reviewing, you quickly find out that the process is a self-defeating one covered with a thick layer of subjective decision making. Take for instance a FreeSWITCH Console application I wrote a few months back.  The application merely does asynchronous socket communication with an open source <a href="http://freeswitch.org">FreeSWITCH</a> server instance that has the &#8220;event socket layer&#8221; module installed.  It&#8217;s a clean pass-through client, built for developers that does nothing more than relay commands that you, the developer, must know.  I submitted the application for review on June 5, 2009.  They just got around to finally responding on July 26, 2009.  What is with this horrible delay?  It speaks clearly that there is a lack of scalability in the Apple reviewer model.  Here is an email I received from the reviewing staff the other day.</p>
<blockquote><p>Hello Chris,</p>
<p>Thank you for your emails and the clarifications.  The account you provided and the instructions you gave do show the application as functional.  However, since the application allows users to connect to any FreeSWITCH server, we need to be able to review all features that a FreeSWITCH server can implement, which include functions such as SIP and PBX.</p>
<p>Please respond to this email with the necessary information, and please upload a new binary to iTunes Connect.</p>
<p>Regards,<br />
iPhone Developer Program<br />
****************************
</p></blockquote>
<p>Let me explain this further. They are asking me to provide them with a SIP/PBX account so that they can go beyond testing my application and begin testing the FreeSWITCH server! If you’ve ever delved into the FreeSWITCH server code itself, you know that it is a well written and scalable telephony application that is incredibly complex. I just want my app in the app store so that other developers can enjoy using their iPhones and iPod Touches to control their developer instances of FreeSWITCH! So why all the trouble, Apple?</p>
<p>As you can see, this has gone well and beyond testing for malware. This is a reviewer subjectively deciding to test a really cool FreeSWITCH server. Now, I have no trouble with that, just don’t do it on my dime. I’ll be re-posting the FreeSWITCH application into the iTunes Connect system in about 3 weeks when my blood has stopped boiling.</p>
<p>I have another application (which will remain unnamed for the time being) that I&#8217;m trying to get into the App Store as well.  First off, I am planning on charging for this one in the Tier 1 model which basically equates to the customer paying $.99.  I posted this app on the store 6 days ago.  Last night, I received the infamous &#8220;taking unexpected additional time for review&#8221; email.  Two hours later, I received the Section 3.3.14 death sentence response::</p>
<blockquote><p>Dear  Mr. Danielson,</p>
<p>Thank you for submitting &#8216;Removed App Name&#8217; to the App Store. We&#8217;ve reviewed &#8216;Removed App Name&#8217; and determined that we cannot post this version of your iPhone application to the App Store because it contains objectionable content and is in violation of Section 3.3.14 from the the iPhone Developer Program License Agreement which states:</p>
<p>&#8220;Applications may be rejected if they contain content or materials of any kind (text, graphics, images, photographs, sounds, etc.) that in Apple&#8217;s reasonable judgement may be found objectionable, for example, materials that may be considered obscene, pornographic, or defamatory.&#8221;</p>
<p>If you believe that you can make the necessary changes so that &#8216;Removed App Name&#8217; does not violate the iPhone Developer Program License Agreement, we encourage you to do so and resubmit it for review.</p>
<p>Regards,<br />
iPhone Developer Program<br />
****************************</p></blockquote>
<p>Wow. My application truly pales in comparison to the likes of Easy-E, Cannibal Corpse, Geto Boys, and any R-rated movies Apple already sells on iTunes, let alone the other similarly themed apps that are already available.  We’re hoping it was our bad luck that we had a reviewer with a dulled sense of humor… anyway we’re now attempting to get it posted into the App Store with some minor revisions.</p>
<p>I’ve really digressed a bit in this blog, but my basic point is that Apple’s App Store Reviewing squad is uncoordinated in their decision making skills. I’ve read online that people with the 3.3.14 issue have only to change their description text and successfully re-submit. If this is the case, then we truly do know that Apple is fraught with subjectivity and developer’s livelihoods are being toyed with. Why not take the high road Apple? Allow applications into the store by merely testing for any sort of malware, and using your already-existing rating system for content. Leave the ultimate purchase decision up to the consumer. Heck, you can hire my company <a href="http://www.maxpowersoft.com">MaxPowerSoft</a> and we’ll even write the grep scripts to automate the red-flagging for any submitted applications. Just don’t cut out your developers – they could be your lifeblood.</p>
<p><em>Special thanks to my brother <a href="http://nicdanielson.com">Nic Danielson</a> for reviewing and editing this post.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<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('p70code8'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p708"><td class="code" id="p70code8"><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>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('p26code12'); return false;">View Code</a> IPHONE_CONSOLE_LOG</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2612"><td class="code" id="p26code12"><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('p26code13'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2613"><td class="code" id="p26code13"><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('p26code14'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2614"><td class="code" id="p26code14"><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>

