<?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>Mac Developer Tips &#187; Xcode</title>
	<atom:link href="http://MacDeveloperTips.com/category/xcode/feed" rel="self" type="application/rss+xml" />
	<link>http://MacDeveloperTips.com</link>
	<description>Tips, tools and code for iPhone and Mac developers.</description>
	<lastBuildDate>Thu, 12 Aug 2010 23:45:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Gotcha: GCC and Unused Values</title>
		<link>http://MacDeveloperTips.com/xcode/gotcha-gcc-and-unused-values.html</link>
		<comments>http://MacDeveloperTips.com/xcode/gotcha-gcc-and-unused-values.html#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:55:57 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=267</guid>
		<description><![CDATA[Subtle typos and the problems they bring, it&#8217;s enough to drive one nuts. Let me share a recent experience that will shed some light on my most recent experience. Below is a short snippet of code that show something similar to what I was recently attempting to do. It&#8217;s nothing more than a variable definition, [...]]]></description>
			<content:encoded><![CDATA[<p>Subtle typos and the problems they bring, it&#8217;s enough to drive one nuts. Let me share a recent experience that will shed some light on my most recent experience. Below is a short snippet of code that show something similar to what I was recently attempting to do. It&#8217;s nothing more than a variable definition, and in one place incrementing the variable, in another I decrementing.<br />
<span id="more-267"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;">NSInteger x <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// Increment x</span>
x <span style="color: #002200;">+=</span> <span style="color: #2400d9;">1</span>;
&nbsp;
...
&nbsp;
<span style="color: #11740a; font-style: italic;">// Decrement x</span>
x <span style="color: #002200;">-+</span> <span style="color: #2400d9;">1</span>;</pre></td></tr></table></div>

<p>One small problem here, there is a typo in the code for decrementing x, which is easy to do given the + and = are on the say key.</p>
<p>It took some time to track down this problem as the compiler does not provide a warning for operations such as this that don&#8217;t have any effect.</p>
<p>Let&#8217;s add a compiler option so we receive a warning when we write a statement has no effect.</p>
<p><strong>Option #1: User Defined GCC Options</strong></p>
<p>- Make sure the Active SDK is set to one of the Simulator options<br />
- Expand the Target option in the project settings<br />
- Right click on the target<br />
- Choose the Build settings<br />
- Scroll to the bottom to the user defined settings<br />
- Add an entry: GCC_WARN_UNUSED_VALUE and set the value to YES</p>
<p><strong>Option #2: GCC Warning Options</strong></p>
<p>- Make sure the Active SDK is set to one of the Device options<br />
- Expand the Target option in the project settings<br />
- Right click on the target<br />
- Choose the Build settings<br />
- Scroll to the section GCC 4.0 &#8211; Warnings<br />
- Select the entry <em>Unused Values</em></p>
<p>Either of the above will suffice, it just depends on what you have set as the Active SDK.</p>
<p>Upon making this change, for statements that have no effect, you will now get a warning generated by the compiler:</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/unused-value1.png" alt="" /></p>
<p>In an upcoming post I&#8217;ll show you how to set this as an option for all project templates.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/gotcha-gcc-and-unused-values.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Xcode Code Completion Macros</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-code-completion-macros.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-code-completion-macros.html#comments</comments>
		<pubDate>Thu, 26 Mar 2009 21:17:36 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=266</guid>
		<description><![CDATA[In the previous post I described the basics for working with code completion in Xcode. In this post I will show how you can use built-in text macros to insert various code fragments. As an example, begin by entering ifelse into Xcode and follow this by pressing Control . (control period) and you&#8217;ll see the [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://macdevelopertips.com/xcode/xcode-code-completion.html" target="_blank">previous post</a> I described the basics for working with code completion in Xcode. In this post I will show how you can use built-in text macros to insert various code fragments.</p>
<p>As an example, begin by entering <strong>ifelse</strong> into Xcode and follow this by pressing <strong>Control .</strong> (control period) and you&#8217;ll see the following code block inserted:<br />
<span id="more-266"></span></p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/ifelse.png" alt="" /></p>
<p>At this point you can add code into the placeholder fields, moving from one field to the next using <strong>Control /</strong> (control forward-slash).</p>
<p>If you enter a code snippet in which there is more than one possible match, you can cycle through the options by pressing <strong>F5</strong> which will bring up a list of options in a popup window, or pressing <strong>Command .</strong> will cycle through the choices inline in your code.</p>
<p>For example, if you enter <strong>if</strong> and follow this by pressing F5, you will be shown the window below:</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/if.png" alt="" /></p>
<p><strong>List of Available Macros</strong></p>
<p>The <a href="http://developer.apple.com/documentation/developertools/Conceptual/XcodeWorkspace/100-The_Text_Editor/chapter_5_section_8.html" target="_blank">Xcode documentation</a> includes a list of macros available for C, C++ and Objective-C. Some of the macros I use on a regular basis are shown below:</p>
<ul>
<li>nss -&gt; NSString</li>
<li>nsms -&gt; NSMutableString</li>
<li>nsd -&gt; NSDictionary</li>
<li>nsmd -&gt; NSMutableDictionary</li>
<li>a -&gt; array (press Control-. to toggle through options)</li>
<li>log -&gt; NSLog</li>
<li>if -&gt; if else (press Control-. to toggle through options)</li>
</ul>
<p><strong>Text Macros from the Menu System</strong><br />
Xcode includes a menu of text macros for C, C++, HTML among others. You can find these macros in the <strong>Edit</strong> menu under <strong>Insert Text Macro</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-code-completion-macros.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xcode Code Completion</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-code-completion.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-code-completion.html#comments</comments>
		<pubDate>Thu, 05 Mar 2009 14:26:35 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=265</guid>
		<description><![CDATA[What follows is a quick review of how I use code completion in Xcode. Chances are that options and features exist beyond what I&#8217;ll cover here, so comments and suggestions are welcome. Let&#8217;s say I want to insert a CGRectMake method. I can begin by typing CG and pressing F5 (or Option-esc), which will popup [...]]]></description>
			<content:encoded><![CDATA[<p>What follows is a quick review of how I use code completion in Xcode. Chances are that options and features exist beyond what I&#8217;ll cover here, so comments and suggestions are welcome.</p>
<p>Let&#8217;s say I want to insert a CGRectMake method. I can begin by typing <strong>CG</strong> and pressing F5 (or Option-esc), which will popup a list of possible matches:<br />
<span id="more-265"></span></p>
<p><img width="500" src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/codecompl2.png" /></p>
<p>If I choose an entry from this list, Xcode takes care of the rest. If I continue to type characters (instead of hitting F5), Xcode will further narrow the available matches (assuming there is more than one). Again, at any point I can press F5 to bring up the matching list.</p>
<p>As an alternative to using F5 for a list of suggestions, I can hit tab at any point and Xcode will insert the matched text currently displayed. For example, in the figure below I entered <strong>CGRe</strong> and Xcode inserted the suggestion shown below:</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/codecompl1.png" /></p>
<p>If I&#8217;d like to go with this suggestion, pressing the <strong>Tab</strong> key will insert the code.</p>
<p><strong>Filling in Placeholder Fields</strong><br />
The next step is to fill in any required fields that Xcode has recognized. If there are parameters, Xcode will highlight the first field as shown:</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/codecompl3.png" /></p>
<p>Enter the value you want in the field and press <strong>Control /</strong> to move to the next field.<br />
<strong><br />
Code Sense Preference Settings</strong><br />
If you have any trouble getting these suggestions to work, I&#8217;ve included a screenshot of the Code Sense settings that I have configured in Xcode:</p>
<p><img width="550" src="http://iPhoneDeveloperTips.com/wp-content/uploads/2009/03/codecompl0.png" /></p>
<p>In the next post I&#8217;ll show how you can use various built-in macros to quickly insert blocks of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-code-completion.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Xcode Expert Preference Settings</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-expert-preference-settings.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-expert-preference-settings.html#comments</comments>
		<pubDate>Thu, 19 Feb 2009 15:20:33 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=261</guid>
		<description><![CDATA[Beyond the settings you can access from the Preferences menu of Xcode, there are a number of configurable options that can be set using the defaults command from a terminal window. Two of the settings that I have configured are to beep when a left bracket ( ] ) is entered without a matching right [...]]]></description>
			<content:encoded><![CDATA[<p>Beyond the settings you can access from the Preferences menu of Xcode, there are a number of configurable options that can be set using the <strong>defaults</strong> command from a terminal window.</p>
<p>Two of the settings that I have configured are to beep when a left bracket ( <strong>]</strong> ) is entered without a matching right bracket, and second, to increase the number of entries in the recent projects menu (<strong>File</strong> menu, <strong>Recent Projects</strong>).<br />
<span id="more-261"></span></p>
<p>From a terminal window, here are the commands I ran to set each preference:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">defaults write com.apple.Xcode PBXBeepOnNoMatchingBrace YES
defaults write com.apple.Xcode NSRecentDocumentsLimit 20</pre></div></div>

<p>You can see the entire list of available settings by reading the document <strong>Xcode Expert Preferences Notes</strong> (see the Bookmarks section in the Xcode documentation window).</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-expert-preference-settings.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Company Name in Xcode</title>
		<link>http://MacDeveloperTips.com/xcode/change-company-name-in-xcode.html</link>
		<comments>http://MacDeveloperTips.com/xcode/change-company-name-in-xcode.html#comments</comments>
		<pubDate>Mon, 02 Feb 2009 02:16:24 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=260</guid>
		<description><![CDATA[Although covered many other places on the net, I recently had to make a change to the name that Xcode automagically inserts when creating new files, so I figured I&#8217;d also pass on this tip to readers of this blog as well. By default, Xcode inserts a company name something similar to the following in [...]]]></description>
			<content:encoded><![CDATA[<p>Although covered many other places on the net, I recently had to make a change to the name that Xcode automagically inserts when creating new files, so I figured I&#8217;d also pass on this tip to readers of this blog as well.</p>
<p>By default, Xcode inserts a company name something similar to the following in all new source files (.m .h etc):<br />
<span id="more-260"></span></p>
<blockquote><p>Copyright (c) 2009 MyCompanyName. All rights reserved.</p></blockquote>
<p>Changing this reference is as simple as entering the following from within a terminal window, replacing &#8220;YourNameHere&#8221; with the text you prefer. Also, make sure this is all entered on one line in the terminal.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions 
   '{ORGANIZATIONNAME=&quot;YourNameHere&quot;;}'</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/change-company-name-in-xcode.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Xcode FIXME and TODO</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-fixme-and-todo.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-fixme-and-todo.html#comments</comments>
		<pubDate>Tue, 23 Dec 2008 07:08:54 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=256</guid>
		<description><![CDATA[In a previous post I introduced how to use #pragma mark to help navigate source files within Xcode. There are several additional tags that can be used within a source file to call out specific code or content. // TODO: This tag is handy for reminding yourself of things that you need to get back [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://macdevelopertips.com/xcode/xcode-and-pragma-mark.html" target="_blank">previous post</a> I introduced how to use <span style="color: #800000;"><em>#pragma mark</em> </span> to help navigate source files within Xcode. There are several additional tags that can be used within a source file to call out specific code or content.<br />
<span id="more-256"></span></p>
<p><strong>// TODO:</strong></p>
<p>This tag is handy for reminding yourself of things that you need to get back to at some point. I generally into these statements at the top of the source file within the main comment block to remind me of features I need to update or add. Here is how this might look in a code block:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  BirdBookAppDelegate.m</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">// TODO: Check for existence of files</span>
<span style="color: #11740a; font-style: italic;">// TODO: Refactor code for NSNotification</span>
<span style="color: #6e371a;">#pragma mark -</span></pre></div></div>

<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/10/xcode1.png" alt="" /></p>
<p><strong>// FIXME:</strong></p>
<p>Another useful tag, this one calls out code that needs to be re-visited for changes/fixes. The code below shows one example of how this looks, and the figure above shows how this appears inside the Functions menu in Xcode.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">  <span style="color: #11740a; font-style: italic;">// FIXME: Change memory mgmt handling in this block.</span>
  <span style="color: #11740a; font-style: italic;">// Create portrait window and content view (to hold other views)</span>
  UIWindow <span style="color: #002200;">*</span>localPortraitWindow;</pre></div></div>

<p><strong>// ??? and /// !!!:</strong></p>
<p>These two tags I don&#8217;t use as frequently as those above, however, they do have there place. I use the former when I&#8217;m not sure how something works and I need to come back another time to dig a little deeper. The later is nice if you need a reminder of a significant task to perform, for example, verifying that all objects are released inside the dealloc() method. The following code shows both tags inside a source file:</p>

<div class="wp_syntax"><div class="code"><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> applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application
<span style="color: #002200;">&#123;</span>
  <span style="color: #11740a; font-style: italic;">// ???: How does this work?</span>
  <span style="color: #002200;">&#91;</span>segmentedControl addTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>segmentAction<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> forControlEvents<span style="color: #002200;">:</span>UIControlEventValueChanged<span style="color: #002200;">&#93;</span>;
  ...
  ...
<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: #11740a; font-style: italic;">// !!!: Verify that all objects are accounted for</span>
  <span style="color: #002200;">&#91;</span>tabBarController release<span style="color: #002200;">&#93;</span>;
...</pre></div></div>

<p>The tags for the above would look as follows inside the Functions menu:</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/10/xcode2.png" alt="" /></p>
<p>Once you get accustomed to using #pragma and one or more of the tags above, it becomes second nature to insert these as you write code. And trust me, these are of great help as the size and complexity of your projects grows.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-fixme-and-todo.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Uninstall Xcode</title>
		<link>http://MacDeveloperTips.com/xcode/how-to-uninstall-xcode.html</link>
		<comments>http://MacDeveloperTips.com/xcode/how-to-uninstall-xcode.html#comments</comments>
		<pubDate>Fri, 03 Oct 2008 08:22:54 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=253</guid>
		<description><![CDATA[A friend in San Francisco, Rodney Aiglstorfer, was recently jumping through hoops to get Xcode to cooperate with his iPhone. There&#8217;s nothing more aggravating than having your application running within the simulator and getting stuck downloading to a device. At one point in the process he opted to remove the Xcode developer tools and start [...]]]></description>
			<content:encoded><![CDATA[<p>A friend in San Francisco, <a href="http://www.mobuser.com/" target="_blank">Rodney Aiglstorfer</a>, was recently jumping through hoops to get Xcode to cooperate with his iPhone. There&#8217;s nothing more aggravating than having your application running within the simulator and getting stuck downloading to a device.</p>
<p>At one point in the process he opted to remove the Xcode developer tools and start the configuration from the beginning. Which leads to the tip: should you ever find the need to remove Xcode, run the following from within a terminal window to make it happen:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo &lt;Xcode&gt;/Library/uninstall-devtools --mode=all</pre></div></div>

<p>&lt;Xcode&gt; is the directory where the tools are installed. For typical installations the full path is /Developer/Library/uninstall-devtools</p>
<p>Easy enough, just make sure this is what you really intend to do as once it&#8217;s gone, it&#8217;s gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/how-to-uninstall-xcode.html/feed</wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
		<item>
		<title>Xcode and #pragma mark</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-and-pragma-mark.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-and-pragma-mark.html#comments</comments>
		<pubDate>Tue, 30 Sep 2008 11:35:12 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[#pragma]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=251</guid>
		<description><![CDATA[I&#8217;ve started using #pragma mark directives in my code to help with organization as my implementation files grow. #pragma mark is simple to use, for example, insert the following to call out initialization code: #pragma mark - #pragma mark Initialization Once this is in place, the Functions Menu (in the navigation bar) which shows a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started using <span style="color: #800000;"><em>#pragma mark</em> </span> directives in my code to help with organization as my implementation files grow. #pragma mark is simple to use, for example, insert the following to call out initialization code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Initialization</span></pre></div></div>

<p><span id="more-251"></span></p>
<p>Once this is in place, the Functions Menu (in the navigation bar) which shows a list of locations within a source file (e.g. definitions of classes, functions and methods) will display a new marker with the label &quot;Initialization.&quot; The code in line 1 will add a line separator inside the Functions Menu, in this example, with the line appearing above the &quot;Initialization&quot; marker.</p>
<p>The figure that follows shows an example of how you might use #pragma mark to divide up various sections of your code.</p>
<p><img src="http://macdevelopertips.com/wp-content/uploads/2008/09/pragma.png" alt="" /></p>
<p><strong>Two notes: </strong></p>
<ol>
<li>You cannot have a space after the &quot;-&quot; in the <span style="color: #800000;"><em>#pragma mark -</em> </span></li>
<li>If your code does not appear as expected (e.g. the separator does not appear), check that &#8216;Sort list alphabetically&#8217; is <strong><em>not</em> </strong> checked in the Code Sense preference settings.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-and-pragma-mark.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Xcode Debugging: Reset Current Line</title>
		<link>http://MacDeveloperTips.com/xcode/xcode-debugging-reset-current-line.html</link>
		<comments>http://MacDeveloperTips.com/xcode/xcode-debugging-reset-current-line.html#comments</comments>
		<pubDate>Mon, 15 Sep 2008 13:06:44 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=247</guid>
		<description><![CDATA[This tip is based on information in the book Xcode 3 Unleashed. I just completed a three part review the book, which you can read here. When inside a debugger and stepping through code, line be line, have you ever wanted to move to the top of a loop and restart, including resetting counters, without [...]]]></description>
			<content:encoded><![CDATA[<p>This tip is based on information in the book <a href="http://www.amazon.com/gp/product/0321552636?ie=UTF8&amp;tag=macdevelopertips-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=0321552636" target="_blank">Xcode 3 Unleashed</a>. I just completed a three part review the book, which you can read <a href="http://macdevelopertips.com/book-reviews/xcode-3-unleashed-part-i.html" target="_blank">here</a>.</p>
<p>When inside a debugger and stepping through code, line be line, have you ever wanted to move to the top of a loop and restart, including resetting counters, without having to restart the application/debugger? Here&#8217;s a cool trick you can use within Xcode to do just that. In the figure below, notice that the current value of the variable <em><strong>name</strong> </em> is <span style="color: #ff0000;"><em>America/Antigua</em></span>.<br />
<span id="more-247"></span></p>
<p><img src="http://iphonedevelopertips.com/wp-content/uploads/2008/09/debug1.png" alt="" /></p>
<p>Also notice in the figure above that the current point of execution (the red arrow) is inside the for loop. In the next figure, notice that <span style="color: #ff0000;"><em>America/Antigua</em> </span> is fourth down in the list of known time zones. Therefore, we know that this is our fourth time through the for loop.</p>
<p><img src="http://iphonedevelopertips.com/wp-content/uploads/2008/09/debug2.png" alt="" /></p>
<p>Here&#8217;s the tip: we can click/drag the red arrow in the debugger and move it back up to line 117. By doing so, we can start the for loop again from the beginning.</p>
<p><img src="http://iphonedevelopertips.com/wp-content/uploads/2008/09/debug3.png" alt="" /></p>
<p>See the figure below and notice that this time through the loop the variable <em><strong>name</strong> </em> is <span style="color: #ff0000;"><em>Europe/Andora</em> </span> , the first entry in the list.</p>
<p><img src="http://iphonedevelopertips.com/wp-content/uploads/2008/09/debug4.png" alt="" /></p>
<p>Rather than restart a debugging session to reset a variable or begin at the top of a loop, try this approach instead. This is one of many good tips you&#8217;ll find in the book  <a href="http://www.amazon.com/gp/product/0321552636?ie=UTF8&amp;tag=macdevelopertips-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=0321552636" target="_blank">Xcode 3 Unleashed</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/xcode/xcode-debugging-reset-current-line.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filename and Line Number with NSLog: Part I</title>
		<link>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html</link>
		<comments>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html#comments</comments>
		<pubDate>Tue, 19 Aug 2008 12:26:17 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=240</guid>
		<description><![CDATA[Coming from a C development background, long before the days of integrated debuggers, printf() was the primary tool for tracking down bugs. Building on that, NSLog is no doubt helpful. However, as the amount of code in a project grows, I often find that another reference point in the output would be helpful, namely, the [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from a C development background, long before the days of integrated debuggers, printf() was the primary tool for tracking down bugs. Building on that, NSLog is no doubt helpful. However, as the amount of code in a project grows, I often find that another reference point in the output would be helpful, namely, the filename and line number where the NSLog calls originate.</p>
<p>This is a two part series on creating a new class that wraps NSLog to add several additional debugging features including output of the filename/path, line number information and the option to turn debug messages off/on.</p>
<p>You can read the rest of the tip on the <a href="http://iphonedevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-i.html" target="_blank">iPhone Developer Tips</a> blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://MacDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-i.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

