<?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>A Tasty Pixel » Blog &#187; XCode</title>
	<atom:link href="http://atastypixel.com/blog/tag/xcode/feed/" rel="self" type="application/rss+xml" />
	<link>http://atastypixel.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 15:08:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Fixing Xcode 4&#8242;s symbolicate utility to get comprehensible crash logs</title>
		<link>http://atastypixel.com/blog/fixing-xcode-4s-symbolicate-utility-to-get-comprehensible-crash-logs/</link>
		<comments>http://atastypixel.com/blog/fixing-xcode-4s-symbolicate-utility-to-get-comprehensible-crash-logs/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 19:30:58 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/fixing-xcode-4s-symbolicate-utility-to-get-comprehensible-crash-logs/</guid>
		<description><![CDATA[&#8216;symbolicatecrash&#8217; is the Developer Tools utility which replaces all those meaningless addresses from crash logs with actual symbol names and source code references. It lives at some obscure folder within /Developer &#8211; use find to dig it up and symlink it into /usr/local/bin if you wanna use it conveniently from the command line. Anyway, after [...]]]></description>
			<content:encoded><![CDATA[<p>&#8216;symbolicatecrash&#8217; is the Developer Tools utility which replaces all those meaningless addresses from crash logs with actual symbol names and source code references.  It lives at some obscure folder within <code>/Developer</code> &#8211; use <code>find</code> to dig it up and symlink it into <code>/usr/local/bin</code> if you wanna use it conveniently from the command line.</p>

<p>Anyway, after plenty of frustration, I noticed some chatter about the damn thing being busted in Xcode 4.  Figures!</p>

<p>There&#8217;s an <a href="https://github.com/fourdman/symbolicatecrash-fix">alternate third party version</a> on GitHub, but this didn&#8217;t really help me &#8211; I still got inscrutable errors, so I took a look at the original.</p>

<p>The version that comes with Xcode 4 appears to have some problems distinguishing, say, an iPhone Simulator build of the app from a native build sitting in the Archives folder.  I&#8217;d just see an error about otool and some binary living in the iPhone Simulator folder.</p>

<p>Digging into the errant symbolicatecrash source, I noticed that the code that finds the executable path tests each candidate using otool, but doesn&#8217;t seem to be able to comprehend the output from otool caused by running it on the wrong architecture.</p>

<p>So, replacing the rather unhelpful &#8216;die&#8217; statement on line 323:</p>

<p><code>die "Can't understand the output from otool ($TEST_uuid -&gt; '$otool -arch $arch -l $path')";</code></p>

<p>With a &#8220;No, it ain&#8217;t this executable&#8221; response:</p>

<p><code>return 0;</code></p>

<p>&#8230;solves the problem immediately.  Now I can drag crash logs straight into the Organizer in Xcode, and it&#8217;ll symbolicate correctly.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2199" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/fixing-xcode-4s-symbolicate-utility-to-get-comprehensible-crash-logs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Easy inclusion of OpenSSL into iOS projects</title>
		<link>http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/</link>
		<comments>http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/#comments</comments>
		<pubDate>Sat, 01 Jan 2011 13:02:54 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/</guid>
		<description><![CDATA[Oddly, iOS doesn&#8217;t provide any OpenSSL implementation at all &#8212; If you want to do anything with crypto (like checking signatures, checksumming, etc.), you have to build in the library yourself. I came across a great XCode project wrapper for OpenSSL yesterday, by Stephen Lombardo. This is an XCode project file that contains a target [...]]]></description>
			<content:encoded><![CDATA[<p>Oddly, iOS doesn&#8217;t provide any OpenSSL implementation at all &#8212; If you want to do anything with crypto (like checking signatures, checksumming, etc.), you have to build in the library yourself.</p>

<p>I came across a great <a href="https://github.com/sjlombardo/openssl-xcode">XCode project wrapper</a> for OpenSSL yesterday, by Stephen Lombardo.  This is an XCode project file that contains a target to build OpenSSL from source, and works with both Mac and iOS projects.  I made some <a href="https://github.com/michaeltyson/openssl-xcode">modifications</a> to it, in order to make it work by just dropping in the OpenSSL source tarball, without having to dirty up your source tree with the extracted OpenSSL distribution.</p>

<p>Here&#8217;s how to use it:</p>

<ol>
<li><a href="http://www.openssl.org/source/">Download the OpenSSL source</a>.</li>
<li>Put the downloaded OpenSSL source tar.gz into the same folder
as openssl.xcodeproj (I put it in <code>Library/openssl</code> within my project tree).</li>
<li>Drag the openssl.xcodeproj file into your main project tree in XCode.</li>
<li>Right-click on your project target, and add openssl.xcodeproj under &#8220;Direct
Dependencies&#8221; on the General tab.</li>
<li><p>On the Build tab for your project&#8217;s target, find the &#8220;Header Search Paths&#8221; 
option, and add the path:</p>

<blockquote>
  <p><code>$(SRCROOT)/Library/openssl/build/openssl.build/openssl/include</code></p>
</blockquote>

<p>(Assuming you&#8217;ve put openssl.xcodeproj at the path <code>Library/openssl</code> &#8212; adjust as necessary).</p></li>
<li>Expand your target&#8217;s &#8220;Link Binary With Libraries&#8221; build stage, and drag
libcrypto.a from the openssl.xcodeproj group.</li>
</ol>

<p>Then, you can just import and use as normal (<code>#import &lt;openssl/dsa.h&gt;</code>, etc).</p>

<p><a href="https://github.com/michaeltyson/openssl-xcode/zipball/master">Download it here</a></p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2100" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/easy-inclusion-of-openssl-into-iphone-app-projects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unit testing and coverage with XCode</title>
		<link>http://atastypixel.com/blog/unit-testing-and-coverage-with-xcode/</link>
		<comments>http://atastypixel.com/blog/unit-testing-and-coverage-with-xcode/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 17:52:54 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/11/29/unit-testing-and-coverage-with-xcode/</guid>
		<description><![CDATA[There are several great resources out there on how to incorporate unit testing into XCode projects. It&#8217;s all built into XCode now, and it&#8217;s fantastic. I just got coverage working too, thanks to a useful article at SuperMegaUltraGroovy on how to use code coverage with XCode. There were a couple of caveats that I thought [...]]]></description>
			<content:encoded><![CDATA[<p>There are several great resources out there on how to <a href="http://developer.apple.com/tools/unittest.html">incorporate</a> unit testing into XCode projects.  It&#8217;s all built into XCode now, and it&#8217;s fantastic.</p>

<p>I just got coverage working too, thanks to a useful article at SuperMegaUltraGroovy on how to use <a href="http://www.supermegaultragroovy.com/blog/2005/11/03/unit-testing-and-code-coverage-with-xcode/">code coverage with XCode</a>.  There were a couple of caveats that I thought I&#8217;d share, though.<span id="more-1685"></span>So, to repeat SMUG&#8217;s instructions:</p>

<ol>
<li>Set up <a href="http://developer.apple.com/tools/unittest.html">unit testing</a></li>
<li>Create a new build configuration (&#8216;Coverage&#8217;), duplicated from the &#8216;Debug&#8217; configuration</li>
<li>Open up build settings for the main target, make sure your new configuration is selected, and:

<ul>
<li>Enable &#8220;Generate Test Coverage Files&#8221;</li>
<li>Enable &#8220;Instrument Program Flow&#8221;</li>
<li>Add &#8220;<code>-lgcov</code>&#8221; to &#8220;Other Linker Flags&#8221;</li>
</ul></li>
</ol>

<p>SMUG proposes some commands to append to the &#8220;Run Script&#8221; build phase of the unit test target, in order to generate the coverage report and output a summary to the build results (see the original article).  I made some modifications to aid readability.  So, instead, I added the following to the &#8220;Run Script&#8221; phase of the unit test target:</p>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># Run gcov on the framework getting tested
if [ &quot;${CONFIGURATION}&quot; = 'Coverage' ]; then
     TARGET_NAME=&quot;My Application&quot;
     OBJ_DIR=${OBJROOT}/${TARGET_NAME}.build/${CONFIGURATION}/${TARGET_NAME}.build/Objects-normal/${CURRENT_ARCH}
     mkdir -p Coverage
     pushd Coverage
     find &quot;${OBJROOT}&quot; -name *.gcda -exec gcov -o &quot;${OBJ_DIR}&quot; {} \; 2&gt;/tmp/gconv-stderr | egrep &quot;^File|^Lines&quot; | sed -E &quot;s@File '$SRCROOT/@@;s@(\.[a-zA-Z])'@\1: @;s@Lines executed:([0-9.%]+) of ([0-9]+)@\1 (\2)@&quot; | paste -d&quot; &quot; - - | egrep -v &quot;^File '&quot; | sed -E &quot;s@^([^:]+):([^(]*)(\([^)]+\))@\2:\1\3@&quot; | sort -n | sed -E &quot;s@^([^:]+):([^(]*)(\([^)]+\))@\2:\1\3@&quot;; cat /tmp/gconv-stderr | grep -v &quot;version.*, prefer.*&quot;; rm /tmp/gconv-stderr
     popd
fi</pre></div></div>


<p>This orders the results by coverage percentage, reformats the output to be a bit terser and more readable, and suppresses some unnecessary warnings about GCC 4.0 (see below).</p>

<p>Finally, using XCode 3.2 on Snow Leopard (Mac OS X 10.6), I found that there were a few issues.  Using any SDK other than 10.6 results in build errors:</p>

<p><pre>
“<em>vproc_transaction_begin”, referenced from:
_</em>_gcov_init in libgcov.a(_gcov.o)
_vproc_transaction_begin$non_lazy_ptr in libgcov.a(_gcov.o)
“_vproc_transaction_end”, referenced from:
_gcov_exit in libgcov.a(_gcov.o)
_vproc_transaction_end$non_lazy_ptr in libgcov.a(_gcov.o)
ld: symbol(s) not found
</pre></p>

<p>The solution I found in the <a href="http://lists.apple.com/archives/xcode-users/2009/Sep/msg00066.html">Apple lists archives</a> is to use the same SDK as the OS: 10.6 (<em>Project menu, Set Active SDK, 10.6</em>).</p>

<p>After fixing this, I was getting dubious-looking results &#8211; mostly 0.00% code coverage except for a few random files.  The <a href="http://stackoverflow.com/questions/1385568/why-doesnt-gcov-report-any-lines-being-covered-by-my-unit-tests">suggestion</a> for this was to use GCC 4.0 instead of the default 4.2 (edit build settings for the main target, and probably the unit test target too, and select &#8220;GCC 4.0&#8243; under &#8220;C/C++ Compiler Version&#8221;).</p>

<p>After a clean and rebuild, I&#8217;m getting proper results.</p>

<p>Phew.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1685" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/unit-testing-and-coverage-with-xcode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Links for February 10th through February 27th</title>
		<link>http://atastypixel.com/blog/links-february-10th-february-27th/</link>
		<comments>http://atastypixel.com/blog/links-february-10th-february-27th/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 02:02:42 +0000</pubDate>
		<dc:creator>Michael Tyson</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=1383</guid>
		<description><![CDATA[Links for February 10th through February 27th: TinEye Reverse Image Search TinEye is a reverse image search engine. You can submit an image to TinEye to find out where it came from, how it is being used, if modified versions of the image exist, or to find higher resolution versions. Traffic Shaping in Mac OS [...]]]></description>
			<content:encoded><![CDATA[<p>Links for February 10th through February 27th:</p>

<ul class="delicious-bookmarks">
<li><a href="http://tineye.com/">TinEye Reverse Image Search</a> TinEye is a reverse image search engine. You can submit an image to TinEye to find out where it came from, how it is being used, if modified versions of the image exist, or to find higher resolution versions.</li>
<li><a href="http://www.macgeekery.com/hacks/software/traffic_shaping_in_mac_os_x">Traffic Shaping in Mac OS X | Mac Geekery</a> &quot;&#8230;Create several pipes that have a set bandwidth and other properties for all packets that get filed into them; you then add queues to those pipes that determine what priority certain requests will get in that pipe; then you add actual firewall rules to identify packets and file them into queues.&quot;</li>
<li><a href="http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/">Brandon Walkin  &raquo; Introducing BWToolkit</a> BWToolkit is a BSD licensed plugin for Interface Builder 3 that contains commonly used UI elements and other useful objects. Using these objects is as simple as dragging them from the library to your canvas or document window. In particular, &quot;No Code&quot; preferences window and tabbed sheets.</li>
<li><a href="http://forums.mactalk.com.au/56/55433-aussie-iphone-app-developers-irs-2.html">Aussie iPhone app developers and the IRS?</a> Discussion about tax details for Australian iPhone developers. It appears the advice from Apple on the tax form is incorrect for sales on the App Store.</li>
<li><a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting">google-toolbox-for-mac &#8211; How to do iPhone unit testing</a> This is a quick tutorial on doing iPhone unit testing using the facilities in the Google Toolbox For Mac</li>

</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1383" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/links-february-10th-february-27th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

