<?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>Tonny Xu &#187; iPhone Dev</title>
	<atom:link href="http://www.totodotnet.net/category/blog/iphone-dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.totodotnet.net</link>
	<description>Life is like a box of chocolates...</description>
	<lastBuildDate>Thu, 02 Feb 2012 00:44:54 +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>CoreData with NSOrderedSet does not work well on insertion</title>
		<link>http://www.totodotnet.net/2012/02/02/coredata-with-nsorderedset-does-not-work-well-on-insertion/</link>
		<comments>http://www.totodotnet.net/2012/02/02/coredata-with-nsorderedset-does-not-work-well-on-insertion/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 00:44:54 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/?p=852</guid>
		<description><![CDATA[Usually, we generate an entity class with Editor-&#62;Create NSManagedOBject Subclass... For example we created a subclass of NSManagedObject Xcode generates the .h file like this: @interface MyEntity : NSManagedObject @property (nonatomic, retain) NSOrderedSet manySubs; //... some methods generated by Xcode - (void)addManySubsObject:(MySubEntity*)value; //... some other methods generated by Xcode @end and the .m file like &#8230; <a href="http://www.totodotnet.net/2012/02/02/coredata-with-nsorderedset-does-not-work-well-on-insertion/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Usually, we generate an entity class with <code>Editor-&gt;Create NSManagedOBject Subclass...</code>
For example we created a subclass of NSManagedObject</p>

<p>Xcode generates the <code>.h</code> file like this:</p>

<pre><code>@interface MyEntity : NSManagedObject

@property (nonatomic, retain) NSOrderedSet manySubs;

//... some methods generated by Xcode
- (void)addManySubsObject:(MySubEntity*)value;
//... some other methods generated by Xcode

@end
</code></pre>

<p>and the <code>.m</code> file like this:</p>

<pre><code>@implement MyEntity

@dynamic manySubs;

@end
</code></pre>

<p>If you use <code>MyEntity</code> just like this, you will get an error when you try to insert a new <code>MySubEntity</code> class by calling <code>[myEntityObj addManySubsObject:aSubEntityObj];</code>.</p>

<p>The error reads:</p>

<blockquote>
  <p><code>*** -[NSSet intersectsSet:]: set argument is not an NSSet</code></p>
</blockquote>

<p>This is a bug Apple hasn&#8217;t resolved yet, but you can work around this bug by adding the following method to <code>.m</code> file.</p>

<pre><code>- (void)addManySubsObject:(MySubEntity*)value{
    [self willChangeValueForKey:@"manySubs"];
    NSMutableOrderedSet *tempSet = [NSMutableOrderedSet orderedSetWithOrderedSet:self.manySubs];
    [tempSet addObject: value];
    self.manySubs = tempSet;
    [self didChangeValueForKey:@"manySubs"];
}
</code></pre>

<p>Be careful</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2012/02/02/coredata-with-nsorderedset-does-not-work-well-on-insertion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent view vs. hidden view in iOS</title>
		<link>http://www.totodotnet.net/2012/01/22/transparent-view-vs-hidden-view-in-ios/</link>
		<comments>http://www.totodotnet.net/2012/01/22/transparent-view-vs-hidden-view-in-ios/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 13:54:08 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/?p=835</guid>
		<description><![CDATA[Rise the question Here comes the question, how to create a transparent view without any contents? Wow, the answer looks so easy to get! Almost every iOS developer has created one or even more &#8216;transparent view&#8217;s. Let&#8217;s take a look at those solutions. We have 2 solutions. Solutions #1 Create a view with alpha=0.f. take &#8230; <a href="http://www.totodotnet.net/2012/01/22/transparent-view-vs-hidden-view-in-ios/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Rise the question</h2>
<p>Here comes the question,</p>
<blockquote>
<p><strong>how to create a transparent view without any contents</strong>?</p>
</blockquote>
<p>Wow, the answer looks so easy to get! Almost every iOS developer has created one or even more &#8216;transparent view&#8217;s. Let&#8217;s take a look at those solutions. We have 2 solutions.</p>
<h3>Solutions #1</h3>
<p>Create a view with <code>alpha=0.f</code>. take a look at the code below</p>
<pre><code>UIView *transparentView1 = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, 320.f, 460.f)];
transparentView1.alpha = 0.f;
[self.view addSubview:transparentView1];
[transparentView1 release];
</code></pre>
<p>It&#8217;s simple and straight forward. Hum? Let&#8217;s take a look at another solution.</p>
<h3>Solution #2</h3>
<p>Create a view with <code>backgroundColor=[UIColor clearColor]</code>.</p>
<pre><code>UIView *transparentView2 = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, 320.f, 460.f)];
transparentView2.backgroundColor = [UIColor clearColor];
[self.view addSubview:transparentView2];
[transparentView2 release];
</code></pre>
<p>This is also very simple.</p>
<p>So, what&#8217;s the difference between these 2 solutions?</p>
<h2>The difference on surface</h2>
<p>Before we talking about the difference, we need to review some basic yet <strong>key</strong> properties provided by iOS</p>
<ol>
<li><strong>hidden</strong>: set this property to <code>YES</code> will cause the view invisible. default is <code>NO</code>;</li>
<li><strong>alpha</strong>: this property affect all the contents of the view, including drawing and subviews. <strong>animatable</strong>;</li>
<li><strong>backgroundColor</strong>: this only affect the background color, not affect the drawing and subviews of the view. <strong>animatable</strong>;</li>
<li><strong>opaque</strong>: set this property to <code>YES</code>, will gain some performance boost on UI rendering. But need to full fill the rectangle of the view. <em>If <code>opaque</code> is set to <code>YES</code> and the view has full or partial transparent content, the behavior is not define</em>.</li>
</ol>
<blockquote>
<p>Visit apple&#8217;s <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html">document for UIView</a> for detail information.</p>
</blockquote>
<p>With these basic knowledge, we can easily tell the difference between these 2 solutions.</p>
<ul>
<li>Solution #1 uses <code>alpha</code> property to make the view transparent, in another word, it&#8217;s invisible because the view is <strong>hidden</strong>.</li>
<li>Solution #2 sets <code>backgroundColor</code> to transparent color to make it invisible.</li>
<li>Solution #2 only set the background to transparent, if you draw anything on the view, or add some subviews to the view, they are still visible, and solution #1 will make everything in the view invisible, including the custom drawings and all the subviews.</li>
<li>If the view is a clean view without any custom drawings and  subviews, the result of these 2 solutions look the same.</li>
</ul>
<p>They look the same? But actually not the same? Yes, they just look the same, but not exactly the same, so what&#8217;s the real difference?</p>
<h2>Look the same, but…</h2>
<p>There is always a <strong>BUT</strong>.</p>
<p>These 2 solutions look the same, <strong>but</strong> act differently on receiving <strong>touch event</strong>.</p>
<ul>
<li>Solution #1: <code>alpha=0.f;</code>, according to Apple&#8217;s document:<br />
> To hide a view visually, you can either set its hidden property to YES or change its alpha property to 0.0. A hidden view does not receive touch events from the system. However, hidden views do participate in autoresizing and other layout operations associated with the view hierarchy. Thus, hiding a view is often a convenient alternative to removing views from your view hierarchy, especially if you plan to show the views again at some point soon.<br />
><br />
> See <a href="http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW47">Apple&#8217;s document</a></li>
<li>Solution #2: when background color is set to clear color, the alpha is still 1.0, so this view still can receive touch event.</li>
</ul>
<h2>Finally, we have the answer</h2>
<p>Before we get the correct answer, we need to use the correct terminologies to clarify the answer:</p>
<ul>
<li><strong>Hidden View</strong>: when <code>hidden=YES</code> or <code>alpha=0.f</code></li>
<li><strong>Transparent background View</strong>: when <code>backgroundColor</code> is set to clear color</li>
</ul>
<h3>The answer</h3>
<ul>
<li>a <strong>hidden view</strong> will not accept touch event, while a <strong>transparent background view</strong> will.</li>
<li>a <strong>hidden view</strong> may look like a <strong>transparent background view</strong> if add no subviews and draw nothing on the view.</li>
</ul>
<p>With this answer, I think we can use <strong>hidden view</strong> and <strong>transparent background view</strong> correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2012/01/22/transparent-view-vs-hidden-view-in-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Practice on Derive an iPhone project from existed project</title>
		<link>http://www.totodotnet.net/2009/10/06/best-practice-on-derive-an-iphone-project/</link>
		<comments>http://www.totodotnet.net/2009/10/06/best-practice-on-derive-an-iphone-project/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 19:40:17 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[iph]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/?p=376</guid>
		<description><![CDATA[After I finished an iPhone project, I decided to create a similar project based on that one. So, I copied the previous project directory to an new directory and build it. Everything goes fine, the new project was correctly signed and installed on the machine, the icon and Default.png was correctly displayed.  But, only one &#8230; <a href="http://www.totodotnet.net/2009/10/06/best-practice-on-derive-an-iphone-project/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After I finished an iPhone project, I decided to create a similar project based on that one. So, I copied the previous project directory to an new directory and build it. Everything goes fine, the new project was correctly signed and installed on the machine, the icon and Default.png was correctly displayed.  But, only one thing was out of my expectation.</p>
<p>I installed the debug version of the previous project on the simulator and want to compare the look and feel, but after I install the new project, which was derived from the old project, on the iPhone simulator, shit happened! <strong>The old project was <span style="color: #ff0000;">disappeared</span>!</strong> Only the new project was there. I checked the project setting over and over again and got no clue completely. This drove me mad! Was it because I did not rename the project? I simply copied to a new directly, without changing the project name. Nope, it wasn&#8217;t. Was it because I set the wrong Product Name? Nope, it was not. What made the iPhone thinks this 2 apps were the same?</p>
<p>After I googled and tried a lot, just before I want to give up, I suddenly saw a key in info.plist file. the key is &#8220;<span style="color: #0000ff;"><strong>Bundle Identifier</strong></span>&#8220;. Oh My GOD! It should be the reason! My instinct told me! I added some suffix to the identifier to make it unique, then try again on the simulator, <strong><span style="color: #0000ff;">it WORKED</span></strong>! It&#8217;s the reason!</p>
<p>Yes, iPhone Programming Guide told us every project need an unique identifier, thus Apple recommend us use the Java Package Style to identifier each app. But if you are copying project from here to there, you might miss this because without modify it, the app also worked fine. Dude&#8230;.</p>
<p>I hope this would help you if you are facing similar problem as me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/10/06/best-practice-on-derive-an-iphone-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Best practice to protect your iPhone application from pirates</title>
		<link>http://www.totodotnet.net/2009/09/28/the-best-practice-to-protect-your-iphone-application-from-pirates/</link>
		<comments>http://www.totodotnet.net/2009/09/28/the-best-practice-to-protect-your-iphone-application-from-pirates/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 13:34:06 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[anti-hack]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[info.plist]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/?p=333</guid>
		<description><![CDATA[iPhone app developers are facing their hard worked app appears on the pirate app web site the day after it appears on iTunes. So you must want to protect your app as I do, right? But how? What&#8217;s the best way to protect your apps? Here is the best practice by far I know. And &#8230; <a href="http://www.totodotnet.net/2009/09/28/the-best-practice-to-protect-your-iphone-application-from-pirates/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>iPhone app developers are facing their hard worked app appears on the pirate app web site the day after it appears on iTunes. So you must want to protect your app as I do, right? But how? What&#8217;s the best way to protect your apps?</p>
<p>Here is the best practice by far I know. And it&#8217;s really simple and easy to do with. As far as Doskoi know, every hacked iPhone app need to add a key to the info.plist file. They need to add this:</p>
<pre>SignerIdentity
Apple iPhone OS Application Signing</pre>
<p>So it would be easy for us to detect whether your app was pirated or not. Simply using the following code to protect your apps.</p>
<pre>
 NSBundle *bundle = [NSBundle mainBundle];
 NSDictionary *info = [bundle infoDictionary];
 if ([info objectForKey: @"SignerIdentity"] != nil)
 {
 // Add your anti-pirate code here.
 }
</pre>
<p>Hope it will help you.</p>
<p><a href="http://doskoi.cn/2009/08/how-to-protect-iphone-apps-cracks/">Doskoi’s Lounge » iPhone软件的破解保护</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/09/28/the-best-practice-to-protect-your-iphone-application-from-pirates/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Damn it, change the project name cost me a whole day!</title>
		<link>http://www.totodotnet.net/2009/08/14/damn-it-change-the-project-name-cost-me-a-whole-day/</link>
		<comments>http://www.totodotnet.net/2009/08/14/damn-it-change-the-project-name-cost-me-a-whole-day/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 02:44:45 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/08/14/damn-it-change-the-project-name-cost-me-a-whole-day/</guid>
		<description><![CDATA[Yes, I knew, I am SO stupid, I should Google it before I started to change the XCode project name. It cost me a whole day! What a joke. All right, if you are looking for the correct way to change your application&#8217;s name show on the iPhone main screen. You need follow my steps. &#8230; <a href="http://www.totodotnet.net/2009/08/14/damn-it-change-the-project-name-cost-me-a-whole-day/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yes, I knew, I am SO stupid, I should Google it before I started to change the XCode project name. It cost me a whole day! What a joke.</p>
<p>All right, if you are looking for the correct way to <strong>change your application&#8217;s name</strong> show on the iPhone main screen. You need follow my steps.</p>
<ol>
<li>Scroll the left “<strong>Groups &amp; Files</strong>” panel to the top(Where you put it, I putted it in the left.), and double-click your project name. This will lead us to step 2.</li>
<li>In the <strong>Build </strong>tab, find the <strong>configuration</strong> dropdown list, select “<strong>All configurations</strong>”(Usually, on the top), and then type “Product Name”(It’s not case sensitive, remember the space) in the search box next to the dropdown list.</li>
<li>Type whatever name you like in the right side field, and then close it and go to step 4.</li>
<li>Choose <strong>Build-&gt;Clean all targets</strong>, then rebuild your project, It’s done!</li>
</ol>
<p><strong>Remember</strong>! Do <strong>NOT</strong> change your target or add your own target! That’s the wrong way, and will cause code sign failure, and it’s hard to repair!</p>
<p>God, Damn you Apple, you should post a tutorial for the developer. Now I did it for you, and you <strong>should pay me</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/08/14/damn-it-change-the-project-name-cost-me-a-whole-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;AAC&#8221; is &#8220;evil&#8221;</title>
		<link>http://www.totodotnet.net/2009/06/17/aac-is-evil/</link>
		<comments>http://www.totodotnet.net/2009/06/17/aac-is-evil/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 08:44:45 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[CoreAudio]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SystemSound]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/06/17/aac-is-evil/</guid>
		<description><![CDATA[Problem Few days ago, I wrote a post on which is the best audio format we should choose when developing an iPhone app. The conclusion is using IMA4, it’s the best choice if you want to record audio on the device. Today, I was trying to use the System Sound service to play a short &#8230; <a href="http://www.totodotnet.net/2009/06/17/aac-is-evil/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>Few days ago, I wrote a post on <a href="http://www.totodotnet.net/2009/05/14/best-audio-format-for-iphone-audio-programming/">which is the best audio format we should choose</a> when developing an iPhone app. The conclusion is using IMA4, it’s the best choice if you want to record audio on the device.</p>
<p>Today, I was trying to use the System Sound service to play a short audio and in order to save the spaces, I chose the “AAC” format to encode my sound effects. I just thought it’s would be capable for a system sound and didn’t searched the documentation for which format is suit for System Sound. Everything went fine in the simulator. But, when I load the app into the device, and, BOOM~~, it failed to play the sound effect! My first reaction was somewhere programmatic mistake in my code, and after a careful review, I thought the reason could&#160; be the format. So I changed the format back to IMA4, and this time, it went well!</p>
<p>Apparently, System sound did not support AAC format, and I could not find the appropriate document where described it. Apple just pushes us to use IMA4 and other linear PCM format to reduce the CPU and power consume. Yeah, I understand that, but please, place such kind of important information some where we can find it easily! The API documentation could be a good place.</p>
<p>If I am the director of the documentation team, I would promote such information and place it in a notable place! Damn it.</p>
<h3>Why I’m angry?</h3>
<p>Because if you using AAC for recording or System Sound, it works fine on the simulator, but will be failed on the device! If the device does not support AAC for recording and System Sound, <strong><font color="#ff0000">please disable it on the simulator!</font></strong></p>
<h3>Conclusion</h3>
<p>The conclusion is if you want to playback a song or something like this, you can choose AAC as your primary format for it is well supported by hardware codec, <strong>but only for this purpose please</strong>. If you want to record audio or play system sound effect, please choose IMA4, it’s is the second best format for iPhone.</p>
<p>“AAC” is a good compressed format, but it’s also has its cost. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/06/17/aac-is-evil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable autorotation when combining UITabBarController and UINavigationController and your own views</title>
		<link>http://www.totodotnet.net/2009/06/13/how-to-enable-autorotation-when-combining-uitabbarcontroller-and-uinavigationcontroller-and-your-own-views/</link>
		<comments>http://www.totodotnet.net/2009/06/13/how-to-enable-autorotation-when-combining-uitabbarcontroller-and-uinavigationcontroller-and-your-own-views/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 08:19:48 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[AutoRotation]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UITabBarController]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/06/13/how-to-enable-autorotation-when-combining-uitabbarcontroller-and-uinavigationcontroller-and-your-own-views/</guid>
		<description><![CDATA[My app is still not online now, because I have to fix some autorotation problems. Before today, I really didn’t know how to enable autorotation when my app is combined with UITabBarController and UINavigationController and my own views. After doing a little search, The solution is I need to enable autorotation for every view controller &#8230; <a href="http://www.totodotnet.net/2009/06/13/how-to-enable-autorotation-when-combining-uitabbarcontroller-and-uinavigationcontroller-and-your-own-views/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My app is still not online now, because I have to fix some autorotation problems. Before today, I really didn’t know how to enable autorotation when my app is combined with UITabBarController and UINavigationController and my own views. After doing a little search, The solution is I need to enable autorotation for every view controller that will be presented in the UITabBarController.</p>
<p>Let’s assume we have a UITabBarController, theTabBarController and 3 UINavigationController named A, B, C. We need to set all the three controllers(A, B, C) to return YES in this method:</p>
<pre class="csharpcode">- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    <span class="rem">// Return YES for supported orientations</span>
    <span class="kwrd">return</span> YES;
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>OK, now your tab bar and navigation bar and your views will be automatically rotated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/06/13/how-to-enable-autorotation-when-combining-uitabbarcontroller-and-uinavigationcontroller-and-your-own-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>June 8th, is the iPhone Day!</title>
		<link>http://www.totodotnet.net/2009/06/09/june-8th-is-the-iphone-day/</link>
		<comments>http://www.totodotnet.net/2009/06/09/june-8th-is-the-iphone-day/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 07:44:15 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[3rd Generation]]></category>
		<category><![CDATA[APNS]]></category>
		<category><![CDATA[In App Purchase]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/06/09/june-8th-is-the-iphone-day/</guid>
		<description><![CDATA[Yesterday, technically, today, June 8th, is the iPhone Day! WWDC was opened about 14H ago, and almost all the main IT news channel are full of iPhone, We really need to celebrate it, 8th June, the iPhone Day. OK, Let me tell you what’s my interest in iPhone Day. The Rumor was real! The new &#8230; <a href="http://www.totodotnet.net/2009/06/09/june-8th-is-the-iphone-day/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday, technically, today, June 8th, is the iPhone Day! WWDC was opened about 14H ago, and almost all the main IT news channel are full of iPhone, We really need to celebrate it, 8th June, the iPhone Day.</p>
<p>OK, Let me tell you what’s my interest in iPhone Day.</p>
<ul>
<li><a href="http://www.totodotnet.net/2009/05/31/iphone-3rd-generation-new-features-exposed/" target="_blank"><strong>The Rumor</strong></a> was real! </li>
<li>The <strong>new iPhone release date, June 19</strong>, was a little bit earlier than I expected.<a href="http://www.totodotnet.net/wp-content/uploads/2009/06/iphone3gsreleasedate.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="iPhone3GS, Release Date" border="0" alt="iPhone3GS, Release Date" src="http://www.totodotnet.net/wp-content/uploads/2009/06/iphone3gsreleasedate-thumb.png" width="586" height="237" /></a> </li>
<li>Will Apple unlock the <a href="http://www.macrumors.com/2009/05/11/chinese-forum-poster-claims-next-generation-iphone-details/" target="_blank">CPU limitation</a> of current iPhone 3G? Still unknown.</li>
<li><strong>In App Purchase</strong> is really, really what I need. But I could not catch the iPhone 3GS release time.<a href="http://www.totodotnet.net/wp-content/uploads/2009/06/picture5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Picture 5" border="0" alt="Picture 5" src="http://www.totodotnet.net/wp-content/uploads/2009/06/picture5-thumb.png" width="255" height="129" /></a> </li>
<li>I must work much more hard to get my app released.</li>
</ul>
<p>Damn it, I like iPhone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/06/09/june-8th-is-the-iphone-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t use [AVAudioPlayer pause]</title>
		<link>http://www.totodotnet.net/2009/06/02/dont-use-avaudioplayer-pause/</link>
		<comments>http://www.totodotnet.net/2009/06/02/dont-use-avaudioplayer-pause/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 08:32:12 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[AVAudioPlayer]]></category>
		<category><![CDATA[CoreAudio]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/06/02/dont-use-avaudioplayer-pause/</guid>
		<description><![CDATA[AVAudioPlayer is providing a very convenient way to play iPhone supported audio file. Especially, if you want to implement fast forward and rewind, AVAudioPlayer is the best choice. But I just found an odd problem. If I use [AVAudioPlayer pause] method, next time if I invoke [AVAudioPlayer play], it had no responde. But after I &#8230; <a href="http://www.totodotnet.net/2009/06/02/dont-use-avaudioplayer-pause/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>AVAudioPlayer is providing a very convenient way to play iPhone supported audio file. Especially, if you want to implement fast forward and rewind, AVAudioPlayer is the best choice.</p>
<p>But I just found an odd problem. If I use [AVAudioPlayer pause] method, next time if I invoke [AVAudioPlayer play], it had no responde. But after I changed pause to stop, it worked fine. The problem looks like it somewhere inside AVAudioPlayer to control the AudioQueue Object to resume playing. Whatever, by using [AVAudioPlayer stop], you can archive the same goal as [AVAudioPlayer pause] do, I mean FFW and RWD.</p>
<p>BTW, the document said, pause will return YES/NO, but clearly, it is a no return value instance method. The guy who is responsible for this method might copied the same comment from play!</p>
<p><a href="http://www.totodotnet.net/wp-content/uploads/2009/06/picture1.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Picture 1" border="0" alt="Picture 1" src="http://www.totodotnet.net/wp-content/uploads/2009/06/picture1-thumb.png" width="642" height="282" /></a> </p>
<p>What a joke. This line was there since iPhone 2.2, and is still there in 3.0b5. Didn’t there anybody reported this problem? Should I fire a bug?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/06/02/dont-use-avaudioplayer-pause/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AVAudioPlayer could not play after recording via AudioQueue Object.</title>
		<link>http://www.totodotnet.net/2009/05/31/avaudioplayer-could-not-play-after-recording-via-audioqueue-object/</link>
		<comments>http://www.totodotnet.net/2009/05/31/avaudioplayer-could-not-play-after-recording-via-audioqueue-object/#comments</comments>
		<pubDate>Sun, 31 May 2009 02:44:09 +0000</pubDate>
		<dc:creator>tonny.xu</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>
		<category><![CDATA[AVAudioPlayer]]></category>
		<category><![CDATA[CoreAudio]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.totodotnet.net/2009/05/31/avaudioplayer-could-not-play-after-recording-via-audioqueue-object/</guid>
		<description><![CDATA[Problem I&#8217;ve been fighting for AVAudioPlayer and AudioQueue object for 2 days, Here is my Dev environment: iPhone: 3.0Beta 5 OSX 10.5.7 Here is my scenario: 1. I need to use AVAudioPlayer to play a CAF with IMA4 data format. Including fast forward and rewind. 2. I need to use AudioQueue Object to record audio, &#8230; <a href="http://www.totodotnet.net/2009/05/31/avaudioplayer-could-not-play-after-recording-via-audioqueue-object/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>I&#8217;ve been fighting for <font face="Courier New">AVAudioPlayer</font> and <font face="Courier New">AudioQueue</font> object for 2 days,    </p>
<p>Here is my Dev environment:    <br />iPhone: 3.0Beta 5    <br />OSX 10.5.7</p>
<p>Here is my scenario:   <br />1. I need to use <font face="Courier New">AVAudioPlayer</font> to play a CAF with IMA4 data format. Including fast forward and rewind.    <br />2. I need to use <font face="Courier New">AudioQueue</font> Object to record audio, because 3.0 has not go public yet.    <br />3. A common scenario is record an audio A, then play the original audio A&#8217;(Not the one recorded) or vice versa.</p>
<p>The problem is I could <strong>NOT</strong> play the A&#8217; file&#160; after I record file A.    <br /><font face="Courier New">[theAVAudioPlayer play]</font> always return <strong>NO</strong>, but <font face="Courier New">[theAVAudioPlayer prepareToPlay]</font> return <strong>YES</strong>.    <br />This situation only happened after I used the <font face="Courier New">AudioQueue</font> Object for recording. If I did not record, it always worked fine.</p>
<p>About the clean up.   <br />1. I released the <font face="Courier New">theAVAudioPlayer</font> object and set to nil each time after I finished playing.    <br />2. I closed the audio file and deposed the <font face="Courier New">AudioQueue</font> Object each time after I finished recording.</p>
<h2>Solution</h2>
<p>Thanks to <a href="https://devforums.apple.com/people/vitaleye">Vitali Molodtsov</a>[<a href="https://devforums.apple.com/message/74707#74707" target="_blank">Open the original post</a> Needs login], the solution is reset the <font face="Courier New">AudioSessionCategory</font> to <font face="Courier New"><strong>kAudioSessionCategory_MediaPlayback</strong></font> just after finish recording. Then every thing goes fine.</p>
<h2>Conclusion</h2>
<p>I think this is a bug for <font face="Courier New">AVAudioPlayer</font>. Each time, when we initialize an <font face="Courier New">AVAudioPlayer</font> object, it should set the correct <font face="Courier New">AudioSessionCategory</font> for us silently, but it doesn’t. So I’ve fired a bug for Apple. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.totodotnet.net/2009/05/31/avaudioplayer-could-not-play-after-recording-via-audioqueue-object/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

