<?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>Cocoanetics</title>
	<atom:link href="http://www.cocoanetics.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cocoanetics.com</link>
	<description>Our DNA is written in Objective-C</description>
	<lastBuildDate>Sat, 18 May 2013 06:19:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F&amp;language=en_US&amp;category=text&amp;title=Cocoanetics&amp;description=Our+DNA+is+written+in+Objective-C&amp;tags=blog" type="text/html" />
		<item>
		<title>Highlight: Pocket Informant Pro</title>
		<link>http://www.cocoanetics.com/2013/05/highlight-pocket-informant-pro/</link>
		<comments>http://www.cocoanetics.com/2013/05/highlight-pocket-informant-pro/#comments</comments>
		<pubDate>Sat, 18 May 2013 06:17:18 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Administrative]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8208</guid>
		<description><![CDATA[Alex Kac, CEO/Founder of WebIS yesterday announced that Apple had approved their major new version 3 of Pocket Informant. We like to highlight satisfied clients who put our components to good use, Pocket Informant 3 uses DTRichTextEditor. WebIS highlights &#8220;Rich Notes&#8221; as major new feature of the new version. Rich Notes - we now have a full featured Rich Text editor for notes. We’ve got a lot more coming here, but today you can set styles, fonts, typefaces, lists, and more. WebIS has been a key sponsor of the component helping us to enhance the feature set and API of the component with support for lists. This had long been on our roadmap, but without WebIS&#8217; sponsorship we could not have brought it to fruition. WebIS integrated the cutting edge version 1.5 of DTRichTextEditor to enable this feature. Kac had this to say when asked for a testimonial: &#8220;Working with Oliver has been a tremendous joy. We simply could not have shipped on-time and with the quality of rich text support as we did without him. The DTRichTextEditor is a fabulous control with lots of great tools, utilities that we were able to use such as DTHTMLWriter and other classes. I heartily recommend both the control and Oliver.&#8221; The Pro Version of Pocket Informant will be released on Tuesday May 21st as a free update to existing 2.x customers. WebIS also offers a free Go! version which will be receiving the 3.0 treatment in the near future. If you buy a license to DTRichTextEditor you receive full access to all source code residing on our private git server. To celebrate the launch of Pocket Informant please mention keyword PI10 for 10% discount when you buy a license until May 31st.]]></description>
				<content:encoded><![CDATA[<p>Alex Kac, CEO/Founder of <a href="http://webis.net/wp/">WebIS</a> <a href="http://www.pocketinformant.com/Forums/index.php?s=ae222725f9d27a77613142d9d0e9042c&amp;app=blog&amp;module=display&amp;section=blog&amp;blogid=1&amp;showentry=303">yesterday announced</a> that Apple had approved their major new version 3 of <a href="http://webis.net/wp/pocket-informant-pro/">Pocket Informant</a>. We like to highlight satisfied clients who put <a href="http://www.cocoanetics.com/parts-store/">our components</a> to good use, Pocket Informant 3 uses <a href="https://www.cocoanetics.com/parts/dtrichtexteditor/">DTRichTextEditor</a>.</p>
<p><span id="more-8208"></span></p>
<div id="more-8208"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>WebIS highlights &#8220;Rich Notes&#8221; as major new feature of the new version.</p>
<blockquote><p><strong>Rich Notes</strong> - we now have a full featured Rich Text editor for notes. We’ve got a lot more coming here, but today you can set styles, fonts, typefaces, lists, and more.</p></blockquote>
<p>WebIS has been a key sponsor of the component helping us to enhance the feature set and <a href="https://docs.cocoanetics.com/DTRichTextEditor/Classes/DTRichTextEditorView.html">API</a> of the component with support for <strong>lists</strong>. This had long been on our roadmap, but without WebIS&#8217; sponsorship we could not have brought it to fruition.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/iPhone-4-Inch-Screenshot-29.png"><img class="alignnone size-full wp-image-8209" alt="Pocket Informant Pro 3" src="http://i0.wp.com/www.cocoanetics.com/files/iPhone-4-Inch-Screenshot-29.png?resize=320%2C517" data-recalc-dims="1" /></a></p>
<p><strong></strong>WebIS integrated the cutting edge <a title="Rich Text Update 1.5" href="http://www.cocoanetics.com/2013/05/rich-text-update-1-5/">version 1.5</a> of DTRichTextEditor to enable this feature. Kac had this to say when asked for a testimonial:</p>
<blockquote><p>&#8220;Working with Oliver has been a tremendous joy. We simply could not have shipped on-time and with the quality of rich text support as we did without him. The DTRichTextEditor is a fabulous control with lots of great tools, utilities that we were able to use such as DTHTMLWriter and other classes. I heartily recommend both the control and Oliver.&#8221;</p></blockquote>
<p>The Pro Version of Pocket Informant will be released on Tuesday May 21st as a <a href="https://itunes.apple.com/at/app/pocket-informant-pro/id380732176?mt=8">free update</a> to existing 2.x customers. WebIS also offers a free Go! version which will be receiving the 3.0 treatment in the near future.</p>
<p>If you buy a license to DTRichTextEditor you receive full access to all source code residing on our private git server. To celebrate the launch of Pocket Informant please mention keyword <strong>PI10</strong> for 10% discount when you buy a license until May 31st.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8208&amp;md5=817ecf284d398a8fe8d3603ca4b03e90" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/highlight-pocket-informant-pro/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fhighlight-pocket-informant-pro%2F&amp;language=en_GB&amp;category=text&amp;title=Highlight%3A+Pocket+Informant+Pro&amp;description=Alex+Kac%2C+CEO%2FFounder+of+WebIS+yesterday+announced+that+Apple+had+approved+their+major+new+version+3+of+Pocket+Informant.+We+like+to+highlight+satisfied+clients+who+put+our+components+to...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>AutoIngest for Mac 0.5.0</title>
		<link>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-5-0/</link>
		<comments>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-5-0/#comments</comments>
		<pubDate>Fri, 17 May 2013 15:15:18 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[AutoIngest]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8198</guid>
		<description><![CDATA[This weeks update to AutoIngest for Mac (a comunity-driven Mac status bar app for downloading sales reports) brings support for downloading from multiple vendor identifiers. Your vendor identifier is an 8-digit number beginning with an 8. Usually you have only one, but if you &#8211; for example &#8211; move from an Individual to a Company Apple developer account, then your old ID is retired and you get a new one. There might be also other scenarios for people having multiple, now AutoIngest for Mac supports that. Changes ADDED: Support for multiple vendor identifiers For the validation I implemented an NSTokenField, the learnings from that I summarized in a separate article. I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, direct download as well as full source on GitHub. The binary builds have Sparkle for OTA updating and are signed with Developer ID.]]></description>
				<content:encoded><![CDATA[<p>This weeks update to AutoIngest for Mac (a comunity-driven Mac status bar app for downloading sales reports) brings support for downloading from multiple vendor identifiers.</p>
<p>Your vendor identifier is an 8-digit number beginning with an 8. Usually you have only one, but if you &#8211; for example &#8211; move from an Individual to a Company Apple developer account, then your old ID is retired and you get a new one. There might be also other scenarios for people having multiple, now AutoIngest for Mac supports that.</p>
<p><span id="more-8198"></span></p>
<div id="more-8198"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Changes</h3>
<ul>
<li>ADDED: Support for multiple vendor identifiers</li>
</ul>
<p>For the validation I implemented an <a title="Tokenize This!" href="http://www.cocoanetics.com/2013/05/tokenize-this/">NSTokenField</a>, the learnings from that I summarized in a separate article.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-2.41.53-PM.png"><img class="alignnone size-full wp-image-8200" alt="AutoIngest token field" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-2.41.53-PM.png?resize=508%2C354" data-recalc-dims="1" /></a></p>
<p>I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, <a href="http://beta.cocoanetics.com/Cocoanetics/com.cocoanetics.AutoIngest/63/AutoIngest.zip">direct download</a> as well as full source <a href="https://github.com/Cocoanetics/AutoIngest">on GitHub</a>. The binary builds have Sparkle for OTA updating and are signed with Developer ID.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8198&amp;md5=95f3396a6399402ba7c6ba06d206db30" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-5-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fautoingest-for-mac-0-5-0%2F&amp;language=en_GB&amp;category=text&amp;title=AutoIngest+for+Mac+0.5.0&amp;description=This+weeks+update+to+AutoIngest+for+Mac+%28a+comunity-driven+Mac+status+bar+app+for+downloading+sales+reports%29+brings+support+for+downloading+from+multiple+vendor+identifiers.+Your+vendor+identifier+is+an...&amp;tags=AutoIngest%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Tokenize This!</title>
		<link>http://www.cocoanetics.com/2013/05/tokenize-this/</link>
		<comments>http://www.cocoanetics.com/2013/05/tokenize-this/#comments</comments>
		<pubDate>Fri, 17 May 2013 12:05:21 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8190</guid>
		<description><![CDATA[I have two vendor IDs, one from my time as Individual and the newer one since I changed to a Company developer account. There might be other other reasons for having multiple vendor IDs, if you know of any, please let me know. I&#8217;m curious. Now for this week&#8217;s update to AutoIngest for Mac I wanted to turn the plain text Vendor ID field into a token field like the Mac mail app has. Fortunately NSTokenField exists on Mac since 10.4 and today we shall explore its use. Googling for a tutorial did not yield any immediate result, but I found a sample from Apple themselves which I am using for pointers. First step is to go into the preferences controller&#8217;s XIB and replace the NSTextField with an NSTokenField. Connect the token field&#8217;s delegate, also we add an outlet to our file&#8217;s owner so that we interact with it. I set the Layout to &#8220;Scrolls&#8221; and checked &#8220;Uses Single Line Mode&#8221; to have the token field a single line and scrolling horizontally if there are more than two tokens. Even without any additional delegate methods implemented we already get some basic behavior. You can enter text and as soon as you type a comma, the text turns into a token. Now you know why they call it the &#8220;blue pill&#8221;. The token field continuously check its contents and separates tokens by the set tokenizingCharacterSet. The best place for additional setup is the -awakeFromNib. // any non-number is a seperator NSMutableCharacterSet *characterSet = &#91;NSMutableCharacterSet alphanumericCharacterSet&#93;; &#91;characterSet formUnionWithCharacterSet:&#91;NSCharacterSet whitespaceAndNewlineCharacterSet&#93;&#93;; &#91;characterSet formUnionWithCharacterSet:&#91;NSCharacterSet punctuationCharacterSet&#93;&#93;; &#91;characterSet removeCharactersInString:@&#34;1234567890&#34;&#93;; &#160; self.vendorTokenField.tokenizingCharacterSet = characterSet; NSTokenField has a class method defaultTokenizingCharacterSet, which you can overwrite in a subclass if you want to keep your token code in a reusable sub-class of NSTokenField. There are several methods in the NSTokenFieldDelegate protocol which allows us to a few customizations. Token Styles You can think of a token field as an array where all elements are tokens. A token can either be a text string or the above mentioned &#8220;blue pill&#8221;. So if you want to have tokens inside some normal plain text, then the normal text would be represented by NSPlainTextTokenStyle whereas the actual tokens would be using the NSRoundedTokenStyle. In its simplest form you would be using NSString instances for the individual tokens. To achieve the differentiation between plain text and rounded token styles you would employ a delegate method: - &#40;NSTokenStyle&#41;tokenField:&#40;NSTokenField *&#41;tokenField styleForRepresentedObject:&#40;id&#41;representedObject &#123; // make valid vendor ids &#34;blue pill&#34;, everything else plain text if &#40;&#91;representedObject isValidVendorIdentifier&#93;&#41; &#123; return NSRoundedTokenStyle; &#125; &#160; return NSPlainTextTokenStyle; &#125; The representedObject &#8211; as often used on AppKit &#8211; can be any object that should represent the tokens. The default implementation is to use the NSString values you enter, but you can easily provide your own backing objects. Represented Objects If you use represented objects instead of the default strings, then you have to implement several delegate methods because the token field needs to convert between the object and what it should write on the token and what the editing value should be. From the NSTokenField.h header: // If you return nil or don't implement these delegate methods, we will assume // editing string = display string = represented object - &#40;NSString *&#41;tokenField:&#40;NSTokenField *&#41;tokenField displayStringForRepresentedObject:&#40;id&#41;representedObject; - &#40;NSString *&#41;tokenField:&#40;NSTokenField *&#41;tokenField editingStringForRepresentedObject:&#40;id&#41;representedObject; - &#40;id&#41;tokenField:&#40;NSTokenField *&#41;tokenField representedObjectForEditingString: &#40;NSString *&#41;editingString; You provide backing object for a given editing string. Conversely if the user double-clicks on a token this turns into editable text. Finally the display string is the inscription on the blue pills. For example if you have the token represent an email address, then the editing string could be &#8220;Oliver Drobnik &#60;oliver@cocoanetics.com&#62;&#8221; and the display string be just &#8220;Oliver Drobnik&#8221;. In that case you could have a token object class with a displayName and an email string. Autocompletion NSTokenField also supports showing suggestions to the user depending on some initially typed characters. Those are shown after the completionDelay which you can customize. In the case of e-mail addresses you could show the most likely completions entered so far and set the index of the most likely candidate. The defaultCompletionDelay &#8211; also a class method you can override via sub-class &#8211; is 0. When trying out different values I couldn&#8217;t notice any difference however. Autocompletion values are provided with this delegate method. - &#40;NSArray *&#41;tokenField:&#40;NSTokenField *&#41;tokenField completionsForSubstring:&#40;NSString *&#41;substring indexOfToken:&#40;NSInteger&#41;tokenIndex indexOfSelectedItem:&#40;NSInteger *&#41;selectedIndex &#123; *selectedIndex = 1; return @&#91;@&#34;8xxxxxxxx&#34;, @&#34;81234567&#34;&#93;; &#125; If you also change the by-ref selectedIndex then the selection at this index will already be put into the text field. To avoid this you have to return -1. Then you only see the suggestions dangling below the field waiting for the user to pick one. Not setting the value is the same as returning 0. I very briefly considered storing valid vendor IDs in the user defaults and then presenting [...]]]></description>
				<content:encoded><![CDATA[<p>I have two vendor IDs, one from my time as Individual and the newer one since I <a title="Moving from Individual to Company" href="http://www.cocoanetics.com/2011/10/moving-from-individual-to-company/">changed to a Company developer account</a>. There might be other other reasons for having multiple vendor IDs, if you know of any, please let me know. I&#8217;m curious.</p>
<p>Now for this week&#8217;s update to <strong>AutoIngest for Mac</strong> I wanted to turn the plain text Vendor ID field into a token field like the Mac mail app has. Fortunately <strong>NSTokenField</strong> exists on Mac since 10.4 and today we shall explore its use.</p>
<p><span id="more-8190"></span></p>
<div id="more-8190"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Googling for a tutorial did not yield any immediate result, but I found a <a href="http://developer.apple.com/library/mac/#samplecode/Tokens/Introduction/Intro.html">sample from Apple</a> themselves which I am using for pointers.</p>
<p>First step is to go into the preferences controller&#8217;s XIB and replace the NSTextField with an NSTokenField.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-8.25.58-AM.png"><img class="alignnone  wp-image-8191" alt="Adding the NSTokenField" src="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-8.25.58-AM.png?resize=583%2C316" data-recalc-dims="1" /></a></p>
<p>Connect the token field&#8217;s delegate, also we add an outlet to our file&#8217;s owner so that we interact with it. I set the Layout to &#8220;Scrolls&#8221; and checked &#8220;Uses Single Line Mode&#8221; to have the token field a single line and scrolling horizontally if there are more than two tokens.</p>
<p>Even without any additional delegate methods implemented we already get some basic behavior. You can enter text and as soon as you type a comma, the text turns into a token. Now you know why they call it the &#8220;blue pill&#8221;.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-8.55.13-AM.png"><img class="alignnone size-full wp-image-8192" alt="NSTokenField working" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-8.55.13-AM.png?resize=345%2C90" data-recalc-dims="1" /></a></p>
<p>The token field continuously check its contents and separates tokens by the set <strong>tokenizingCharacterSet</strong>. The best place for additional setup is the -awakeFromNib.</p>

<div class="wp_codebox"><table><tr id="p819010"><td class="code" id="p8190code10"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// any non-number is a seperator</span>
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableCharacterSet_Class/"><span style="color: #400080;">NSMutableCharacterSet</span></a> <span style="color: #002200;">*</span>characterSet <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableCharacterSet_Class/"><span style="color: #400080;">NSMutableCharacterSet</span></a> alphanumericCharacterSet<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>characterSet formUnionWithCharacterSet<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCharacterSet_Class/"><span style="color: #400080;">NSCharacterSet</span></a> whitespaceAndNewlineCharacterSet<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>characterSet formUnionWithCharacterSet<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCharacterSet_Class/"><span style="color: #400080;">NSCharacterSet</span></a> punctuationCharacterSet<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>characterSet removeCharactersInString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1234567890&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
self.vendorTokenField.tokenizingCharacterSet <span style="color: #002200;">=</span> characterSet;</pre></td></tr></table></div>

<p>NSTokenField has a class method <strong>defaultTokenizingCharacterSet</strong>, which you can overwrite in a subclass if you want to keep your token code in a reusable sub-class of NSTokenField.</p>
<p>There are several methods in the NSTokenFieldDelegate protocol which allows us to a few customizations.</p>
<h3>Token Styles</h3>
<p>You can think of a token field as an array where <em>all elements</em> are tokens. A token can either be a text string or the above mentioned &#8220;blue pill&#8221;. So if you want to have tokens inside some normal plain text, then the normal text would be represented by <strong>NSPlainTextTokenStyle</strong> whereas the actual tokens would be using the <strong>NSRoundedTokenStyle</strong>.</p>
<p>In its simplest form you would be using NSString instances for the individual tokens. To achieve the differentiation between plain text and rounded token styles you would employ a delegate method:</p>

<div class="wp_codebox"><table><tr id="p819011"><td class="code" id="p8190code11"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSTokenStyle<span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField styleForRepresentedObject<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>representedObject
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// make valid vendor ids &quot;blue pill&quot;, everything else plain text</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>representedObject isValidVendorIdentifier<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">return</span> NSRoundedTokenStyle;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">return</span> NSPlainTextTokenStyle;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>The representedObject &#8211; as often used on AppKit &#8211; can be any object that should represent the tokens. The default implementation is to use the NSString values you enter, but you can easily provide your own backing objects.</p>
<h3>Represented Objects</h3>
<p>If you use represented objects instead of the default strings, then you have to implement several delegate methods because the token field needs to convert between the object and what it should write on the token and what the editing value should be. From the NSTokenField.h header:</p>

<div class="wp_codebox"><table><tr id="p819012"><td class="code" id="p8190code12"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// If you return nil or don't implement these delegate methods, we will assume</span>
<span style="color: #11740a; font-style: italic;">// editing string = display string = represented object</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</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><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField displayStringForRepresentedObject<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>representedObject;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</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><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField editingStringForRepresentedObject<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>representedObject;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField representedObjectForEditingString<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</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><span style="color: #002200;">&#41;</span>editingString;</pre></td></tr></table></div>

<p>You provide backing object for a given editing string. Conversely if the user double-clicks on a token this turns into editable text. Finally the display string is the inscription on the blue pills.</p>
<p>For example if you have the token represent an email address, then the editing string could be &#8220;Oliver Drobnik &lt;oliver@cocoanetics.com&gt;&#8221; and the display string be just &#8220;Oliver Drobnik&#8221;. In that case you could have a token object class with a displayName and an email string.</p>
<h3>Autocompletion</h3>
<p>NSTokenField also supports showing suggestions to the user depending on some initially typed characters. Those are shown after the <strong>completionDelay</strong> which you can customize. In the case of e-mail addresses you could show the most likely completions entered so far and set the index of the most likely candidate. The <strong>defaultCompletionDelay</strong> &#8211; also a class method you can override via sub-class &#8211; is 0. When trying out different values I couldn&#8217;t notice any difference however.</p>
<p>Autocompletion values are provided with this delegate method.</p>

<div class="wp_codebox"><table><tr id="p819013"><td class="code" id="p8190code13"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField completionsForSubstring<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</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><span style="color: #002200;">&#41;</span>substring indexOfToken<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>tokenIndex indexOfSelectedItem<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>selectedIndex
<span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">*</span>selectedIndex <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
	<span style="color: #a61390;">return</span> @<span style="color: #002200;">&#91;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;8xxxxxxxx&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;81234567&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>If you also change the by-ref selectedIndex then the selection at this index will already be put into the text field. To avoid this you have to return -1. Then you only see the suggestions dangling below the field waiting for the user to pick one. Not setting the value is the same as returning 0.</p>
<p>I very briefly considered storing valid vendor IDs in the user defaults and then presenting these to the user for auto-completion, but decided against that.</p>
<h3>Pasteboard</h3>
<p>You might remember from the mail.app that you can drag around the e-mail tokens or even drag them into other apps. To support interaction with the Mac pasteboard you have to implement two methods.</p>
<p>The first method gets an array of represented token objects and lets you add some useful representation(s) to the dragging pasteboard. The objects you set there need to be able to implement the NSPasteboardWriting protocol. Alternatively you can create a property list representation for them  and set this instead of an array of objects.</p>

<div class="wp_codebox"><table><tr id="p819014"><td class="code" id="p8190code14"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField writeRepresentedObjects<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>objects toPasteboard<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/"><span style="color: #400080;">NSPasteboard</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>pboard
<span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>pboard writeObjects<span style="color: #002200;">:</span>objects<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>If you don&#8217;t implement this method then it still works, the default representation is to concatenate all tokens into a single comma-separated string. Since we are only using NSStrings as token objects we don&#8217;t have to do anything special since NSStrings know how to represent themselves on the pasteboard. This implementation causes the tokens to be staying individual values. If you drag&amp;drop them for example into Notepad they come out as one per line.</p>
<h3>Context Menu</h3>
<p>Apple&#8217;s sample also shows how to add individual context menus to the tokens. This is achieved via the following two delegate methods.</p>

<div class="wp_codebox"><table><tr id="p819015"><td class="code" id="p8190code15"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// By default the tokens have no menu.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSMenu_Class/"><span style="color: #400080;">NSMenu</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField menuForRepresentedObject<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>representedObject;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField hasMenuForRepresentedObject<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>representedObject;</pre></td></tr></table></div>

<p>This context menu is possible in addition to auto-completion and is available in the tokenized form. It&#8217;s basically a drop down menu with a down arrow to open it. The sample shows a nice trick how to force a token back into editing mode. This action is tied to an Edit&#8230; menu option.</p>

<div class="wp_codebox"><table><tr id="p819016"><td class="code" id="p8190code16"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span>editCellAction<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>sender
<span style="color: #002200;">&#123;</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSText_Class/"><span style="color: #400080;">NSText</span></a> <span style="color: #002200;">*</span>fieldEditor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.tokensField currentEditor<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">NSRange</span> textRange <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>fieldEditor selectedRange<span style="color: #002200;">&#93;</span>;
&nbsp;
	<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>replacedString <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> stringWithString<span style="color: #002200;">:</span>menuToken.name<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>fieldEditor replaceCharactersInRange<span style="color: #002200;">:</span>textRange withString<span style="color: #002200;">:</span>replacedString<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>fieldEditor setSelectedRange<span style="color: #002200;">:</span>NSMakeRange<span style="color: #002200;">&#40;</span>textRange.location, <span style="color: #002200;">&#91;</span>replacedString length<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>Though I fail to see the practical use of this trick, since you can always go into edit mode by double-clicking on a blue pill token.</p>
<h3>Validation</h3>
<p>We already have a bit of validation going by only turning valid vendor IDs into pills. But there is yet another delegate method which would also allow us to completely reject invalid tokens.</p>
<p>The following only accepts valid tokens. This also removes invalid tokens if you enter a separator or tab out of the field.</p>

<div class="wp_codebox"><table><tr id="p819017"><td class="code" id="p8190code17"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/"><span style="color: #400080;">NSTokenField</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokenField shouldAddObjects<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tokens atIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSUInteger<span style="color: #002200;">&#41;</span>index
<span style="color: #002200;">&#123;</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span style="color: #400080;">NSMutableArray</span></a> <span style="color: #002200;">*</span>validTokens <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span style="color: #400080;">NSMutableArray</span></a> array<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</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>oneToken <span style="color: #a61390;">in</span> tokens<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>oneToken isValidVendorIdentifier<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #002200;">&#91;</span>validTokens addObject<span style="color: #002200;">:</span>oneToken<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<span style="color: #a61390;">return</span> validTokens;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>Depending on your use case you might not want to have invalid tokens simply disappear. If you want to keep them, but just have them be text, then you just forego implementing this delegate method.</p>
<p>A second method to only get validated values into the array of vendor IDs is to have an NSValueTransformer which gets the array of tokens, filters for valid and sorts uniquely.</p>

<div class="wp_codebox"><table><tr id="p819018"><td class="code" id="p8190code18"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@implementation</span> ValidVendorValueTransformer
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">Class</span><span style="color: #002200;">&#41;</span>transformedValueClass
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> class<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;">id</span><span style="color: #002200;">&#41;</span>transformedValue<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>value
<span style="color: #002200;">&#123;</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> <span style="color: #002200;">*</span>array <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>value isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span style="color: #400080;">NSArray</span></a> class<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		array <span style="color: #002200;">=</span> value;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>value isKindOfClass<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> class<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		array <span style="color: #002200;">=</span> @<span style="color: #002200;">&#91;</span>value<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	NSAssert<span style="color: #002200;">&#40;</span>array, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Invalid class for transformer&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// make unique in set</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableSet_Class/"><span style="color: #400080;">NSMutableSet</span></a> <span style="color: #002200;">*</span>validTokens <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableSet_Class/"><span style="color: #400080;">NSMutableSet</span></a> set<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</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>oneToken <span style="color: #a61390;">in</span> array<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>oneToken isValidVendorIdentifier<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
		<span style="color: #002200;">&#123;</span>
			<span style="color: #002200;">&#91;</span>validTokens addObject<span style="color: #002200;">:</span>oneToken<span style="color: #002200;">&#93;</span>;
		<span style="color: #002200;">&#125;</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSortDescriptor_Class/"><span style="color: #400080;">NSSortDescriptor</span></a> <span style="color: #002200;">*</span>sort <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSortDescriptor_Class/"><span style="color: #400080;">NSSortDescriptor</span></a> sortDescriptorWithKey<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span>
                                  ascending<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span>
                                  selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>compare<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>validTokens sortedArrayUsingDescriptors<span style="color: #002200;">:</span>@<span style="color: #002200;">&#91;</span>sort<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>This also has a provision for the vendor ID value previously being a string. With this it automatically migrates the value next time you enter the preferences. You install the value transformer in the data bindings inspector for the token field.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-2.00.52-PM.png"><img class="alignnone size-full wp-image-8195" alt="Installing value transformer" src="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-17-at-2.00.52-PM.png?resize=261%2C365" data-recalc-dims="1" /></a></p>
<p>Also note the &#8220;Continuosly Updates Value&#8221; which I set so that whenever the contents changes the user default gets updated.</p>
<h3>Conclusion</h3>
<p>I wanted to achieve the effect of a valid vendor identifier automatically turning into a rounded token, but failed. I was able to see that the token field would turn valid IDs into my own VendorIdentifier represented objects, but it didn&#8217;t update the display. Only when I entered a separator character or tabbed out of the token field would I see the refresh occur.</p>
<p>There are no other visual customization options &#8211; that I could find &#8211; on NSTokenField so you have to be content with the &#8220;blue pill&#8221; style. But once you wrapped your head around the basic concepts and accepted the limitations of the API you can quickly use token fields to add them to your apps.</p>
<p>They work nicely intermixed with normal text or as &#8220;token only&#8221; fields which you can data-bind to an NSArray.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8190&amp;md5=f7707284fbc25369b6f4d928b965c2a1" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/tokenize-this/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Ftokenize-this%2F&amp;language=en_GB&amp;category=text&amp;title=Tokenize+This%21&amp;description=I+have+two+vendor+IDs%2C+one+from+my+time+as+Individual+and+the+newer+one+since+I+changed+to+a+Company+developer+account.+There+might+be+other+other+reasons+for...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>DTCoreText 1.5.2</title>
		<link>http://www.cocoanetics.com/2013/05/dtcoretext-1-5-2/</link>
		<comments>http://www.cocoanetics.com/2013/05/dtcoretext-1-5-2/#comments</comments>
		<pubDate>Thu, 16 May 2013 13:48:01 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8185</guid>
		<description><![CDATA[I&#8217;ve got a bunch of fixes and enhancements released in DTCoreText 1.5.2 today. Special thanks to Antiloop who sponsored the improvements for handling of padding inside lists. Changes in 1.5.1 FIXED: Attributes &#8220;bleeding&#8221; into next paragraph Changes in 1.5.2 FIXED: Crash on parsing HTML with additional tags following HTML end tag FIXED: DTAttributedLabel problems being instantiated from NIB, ignoring edge insets FIXED: Crash on using font-family &#8220;inherit&#8221; together with font-variant &#8220;small-caps&#8221;. FIXED: Endless loop when using a text block that would not fully fit in a height-constrained layout frame FIXED: Image Attachment ignoring maximum display size if width/height are set via tag attributes FIXED: Invalid font-size would cause Core Text font size of 12px to be used. [Sponsored] CHANGED: Lists now correctly use padding and margin. If you specify too small a margin for the list prefix to fit, then the list prefix is omitted. Contrary to how HTML browsers are displaying list prefixes (e.g. bullets) Core Text cannot draw outside of the laid out lines. This limitation became apparent if you specified a too large list indent margin to fit the prefix. Then the text would spill over the too closely set tab stops and be indented to the next standard tab stop. To prevent this from happening I implemented a check that tests to see if the margin is sufficiently wide to fit the prefix excluding white space. The new version is tagged and available on the GitHub master branch. A new spec has been added to the CocoaPods public repository. This release has one sponsor, as highlighted. Austrian company Antiloop is doing Ruby on Rails, iPhone and iPad development. They are big fans of DTCoreText and are using it in several apps, including: Ecoline for iPad Journal Both apps make great use of rich text and are free downloads on the Apple App Store.]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve got a bunch of fixes and enhancements released in <a href="http://www.cocoanetics.com/parts/dtcoretext/">DTCoreText</a> 1.5.2 today. Special thanks to <a href="http://www.antiloop.at">Antiloop</a> who sponsored the improvements for handling of padding inside lists.</p>
<p><span id="more-8185"></span></p>
<div id="more-8185"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Changes in 1.5.1</h3>
<ul>
<li>FIXED: Attributes &#8220;bleeding&#8221; into next paragraph</li>
</ul>
<h3>Changes in 1.5.2</h3>
<ul>
<li><span style="line-height: 13px;">FIXED: Crash on parsing HTML with additional tags following HTML end tag</span></li>
<li>FIXED: DTAttributedLabel problems being instantiated from NIB, ignoring edge insets</li>
<li>FIXED: Crash on using font-family &#8220;inherit&#8221; together with font-variant &#8220;small-caps&#8221;.</li>
<li>FIXED: Endless loop when using a text block that would not fully fit in a height-constrained layout frame</li>
<li>FIXED: Image Attachment ignoring maximum display size if width/height are set via tag attributes</li>
<li>FIXED: Invalid font-size would cause Core Text font size of 12px to be used.</li>
<li>[Sponsored] CHANGED: Lists now correctly use padding and margin. If you specify too small a margin for the list prefix to fit, then the list prefix is omitted.</li>
</ul>
<p>Contrary to how HTML browsers are displaying list prefixes (e.g. bullets) Core Text cannot draw outside of the laid out lines. This limitation became apparent if you specified a too large list indent margin to fit the prefix. Then the text would spill over the too closely set tab stops and be indented to the next standard tab stop. To prevent this from happening I implemented a check that tests to see if the margin is sufficiently wide to fit the prefix excluding white space.</p>
<p>The new version is tagged and available on the GitHub master branch. A new spec has been added to the CocoaPods public repository.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/mzl.njurxfww.480x480-75.jpg"><img class="alignnone size-full wp-image-8186" alt="Ecoline Screenshot" src="http://i0.wp.com/www.cocoanetics.com/files/mzl.njurxfww.480x480-75.jpg?resize=480%2C360" data-recalc-dims="1" /></a></p>
<p>This release has one <strong>sponsor</strong>, as highlighted. Austrian company <a href="http://www.antiloop.at/">Antiloop</a> is doing Ruby on Rails, iPhone and iPad development. They are big fans of DTCoreText and are using it in several apps, including:</p>
<ul>
<li><span style="line-height: 13px;"><a href="https://itunes.apple.com/at/app/ecoline/id560497054?mt=8">Ecoline for iPad</a></span></li>
<li><a href="https://itunes.apple.com/at/app/journal/id538764071?mt=8">Journal</a></li>
</ul>
<p>Both apps make great use of rich text and are free downloads on the Apple App Store.</p>
<h3></h3>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8185&amp;md5=f406d6a40fc2f77372cc065ec9418d93" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/dtcoretext-1-5-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fdtcoretext-1-5-2%2F&amp;language=en_GB&amp;category=text&amp;title=DTCoreText+1.5.2&amp;description=I%26%238217%3Bve+got+a+bunch+of+fixes+and+enhancements+released+in+DTCoreText+1.5.2+today.+Special+thanks+to+Antiloop%C2%A0who+sponsored+the+improvements+for+handling+of+padding+inside+lists.+Changes+in+1.5.1+FIXED%3A...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Radar: MobileSafari Terminated During Zooming In</title>
		<link>http://www.cocoanetics.com/2013/05/radar-mobilesafari-terminated-during-zooming-in/</link>
		<comments>http://www.cocoanetics.com/2013/05/radar-mobilesafari-terminated-during-zooming-in/#comments</comments>
		<pubDate>Tue, 14 May 2013 08:54:40 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Bug Reports]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8180</guid>
		<description><![CDATA[If you always wanted to crash your MobileSafari and didn&#8217;t dare to ask, here&#8217;s a current way to do it. If you zoom into the right place on our Linguan app product page iOS terminates the app. Thanks to Oisin Prendiville for sending this in. Of course I had to immediately file a bug report. It is slightly bit hilarious that Mobile Safari would crash on my own site. Looks like it&#8217;s somehow running out of &#8220;rpages&#8221;, whatever that means. Filed as rdar://13885055 and on Open Radar. Summary When zooming into the left-hand sidebar on http://www.cocoanetics.com/apps/linguan/ MobileSafari reaches the per process limit of rpages and gets terminated by iOS. Steps to Reproduce In MobileSafari, go to http://www.cocoanetics.com/apps/linguan/ Zoom into the region on the left side titled &#8220;Updates&#8221; Expected Results The tiling should created higher resolution tiles and the display become crisp Actual Results After a second or so the app gets terminated and the following crash report logged Incident Identifier: BAC656CD-EF31-453F-AC4A-AE1E1C8263FC CrashReporter Key: 10d06614c22e25053f76586bd110cdfa0ced43f0 Hardware Model: iPhone5,2 OS Version: iPhone OS 6.1.4 (10B350) Kernel Version: Darwin Kernel Version 13.0.0: Wed Feb 13 21:40:10 PST 2013; root:xnu-2107.7.55.2.2~1/RELEASE_ARM_S5L8950X Date: 2013-05-14 10:38:24 +0200 Time since snapshot: 102 ms Free pages: 1489 Active pages: 8333 Inactive pages: 4370 Throttled pages: 151442 Purgeable pages: 0 Wired pages: 93689 Largest process: MobileSafari Processes Name rpages recent_max [reason] (state) MobileSMS 4349 4349 (background) MobileMail 16656 16656 (continuous) MobilePhone 3598 3598 (continuous) librariand 316 316 (daemon) tccd 335 335 (daemon) kbd 569 569 (daemon) MobileSafari 167691 167691 [per-process-limit] (frontmost) (resume) ptpd 1158 1158 (daemon) dataaccessd 1589 1589 (daemon) wifid 460 460 (daemon) iaptransportd 301 301 (daemon) locationd 1513 1513 (daemon) aosnotifyd 517 517 (daemon) mediaserverd 2164 2164 (daemon) syslogd 172 172 (daemon) SpringBoard 13124 13124 backboardd 36064 36064 (daemon) configd 774 774 (daemon) lockdownd 868 868 (daemon) powerd 163 163 (daemon) mDNSResponder 271 271 (daemon) fairplayd.N42 548 548 (daemon) UserEventAgent 821 821 (daemon) keybagd 149 149 (daemon) springboardservi 0 0 (daemon) syslog_relay 0 0 (daemon) afcd 205 205 (daemon) gputoolsd 0 0 (daemon) syncdefaultsd 494 494 (daemon) ubd 747 747 (daemon) notification_pro 198 198 (daemon) filecoordination 200 200 (daemon) distnoted 132 132 (daemon) apsd 375 375 (daemon) aggregated 98 98 (daemon) networkd 201 201 (daemon) fseventsd 375 375 (daemon) BTServer 506 506 (daemon) imagent 666 666 (daemon) CommCenter 2089 2089 (daemon) notifyd 222 222 (daemon) ReportCrash 307 307 (daemon) **End**]]></description>
				<content:encoded><![CDATA[<p>If you always wanted to crash your MobileSafari and didn&#8217;t dare to ask, here&#8217;s a current way to do it. If you zoom into the right place on our <a href="http://www.cocoanetics.com/apps/linguan/">Linguan app product page</a> iOS terminates the app. Thanks to Oisin Prendiville for sending this in.</p>
<p>Of course I had to immediately file a bug report. It is slightly bit hilarious that Mobile Safari would crash on my own site. Looks like it&#8217;s somehow running out of &#8220;rpages&#8221;, whatever that means.</p>
<p>Filed as rdar://13885055 and on <a href="http://www.openradar.me/radar?id=3009405">Open Radar</a>.</p>
<p><span id="more-8180"></span></p>
<div id="more-8180"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Summary</h3>
<p>When zooming into the left-hand sidebar on http://www.cocoanetics.com/apps/linguan/ MobileSafari reaches the per process limit of rpages and gets terminated by iOS.</p>
<h3>Steps to Reproduce</h3>
<ul>
<li>In MobileSafari, go to http://www.cocoanetics.com/apps/linguan/</li>
<li>Zoom into the region on the left side titled &#8220;Updates&#8221;</li>
</ul>
<h3>Expected Results</h3>
<ul>
<li>The tiling should created higher resolution tiles and the display become crisp</li>
</ul>
<h3>Actual Results</h3>
<ul>
<li>After a second or so the app gets terminated and the following crash report logged</li>
</ul>
<pre>Incident Identifier: BAC656CD-EF31-453F-AC4A-AE1E1C8263FC
CrashReporter Key:   10d06614c22e25053f76586bd110cdfa0ced43f0
Hardware Model:      iPhone5,2
OS Version:          iPhone OS 6.1.4 (10B350)
Kernel Version:      Darwin Kernel Version 13.0.0: Wed Feb 13 21:40:10 PST 2013; root:xnu-2107.7.55.2.2~1/RELEASE_ARM_S5L8950X
Date:                2013-05-14 10:38:24 +0200
Time since snapshot: 102 ms

Free pages:        1489
Active pages:      8333
Inactive pages:    4370
Throttled pages:   151442
Purgeable pages:   0
Wired pages:       93689
Largest process:   MobileSafari

Processes
     Name                                           rpages       recent_max       [reason]          (state)

       MobileSMS          4349             4349                      (background)
      MobileMail         16656            16656                      (continuous)
     MobilePhone          3598             3598                      (continuous)
      librariand           316              316                      (daemon)
            tccd           335              335                      (daemon)
             kbd           569              569                      (daemon)
    MobileSafari        167691           167691  [per-process-limit] (frontmost) (resume)
            ptpd          1158             1158                      (daemon)
     dataaccessd          1589             1589                      (daemon)
           wifid           460              460                      (daemon)
   iaptransportd           301              301                      (daemon)
       locationd          1513             1513                      (daemon)
      aosnotifyd           517              517                      (daemon)
    mediaserverd          2164             2164                      (daemon)
         syslogd           172              172                      (daemon)
     SpringBoard         13124            13124                     
      backboardd         36064            36064                      (daemon)
         configd           774              774                      (daemon)
       lockdownd           868              868                      (daemon)
          powerd           163              163                      (daemon)
   mDNSResponder           271              271                      (daemon)
   fairplayd.N42           548              548                      (daemon)
  UserEventAgent           821              821                      (daemon)
         keybagd           149              149                      (daemon)
springboardservi             0                0                      (daemon)
    syslog_relay             0                0                      (daemon)
            afcd           205              205                      (daemon)
       gputoolsd             0                0                      (daemon)
   syncdefaultsd           494              494                      (daemon)
             ubd           747              747                      (daemon)
notification_pro           198              198                      (daemon)
filecoordination           200              200                      (daemon)
       distnoted           132              132                      (daemon)
            apsd           375              375                      (daemon)
      aggregated            98               98                      (daemon)
        networkd           201              201                      (daemon)
       fseventsd           375              375                      (daemon)
        BTServer           506              506                      (daemon)
         imagent           666              666                      (daemon)
      CommCenter          2089             2089                      (daemon)
         notifyd           222              222                      (daemon)
     ReportCrash           307              307                      (daemon)

**End**</pre>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8180&amp;md5=353b21c9e830386a67678a7d8f6ff242" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/radar-mobilesafari-terminated-during-zooming-in/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fradar-mobilesafari-terminated-during-zooming-in%2F&amp;language=en_GB&amp;category=text&amp;title=Radar%3A+MobileSafari+Terminated+During+Zooming+In&amp;description=If+you+always+wanted+to+crash+your+MobileSafari+and+didn%26%238217%3Bt+dare+to+ask%2C+here%26%238217%3Bs+a+current+way+to+do+it.+If+you+zoom+into+the+right+place+on+our+Linguan...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Simple Reachability + Blocks</title>
		<link>http://www.cocoanetics.com/2013/05/simple-reachability-blocks/</link>
		<comments>http://www.cocoanetics.com/2013/05/simple-reachability-blocks/#comments</comments>
		<pubDate>Sun, 12 May 2013 07:13:42 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8175</guid>
		<description><![CDATA[The Reachability sample is arguable the one piece of Apple sample code that is seen in most wide use. But it is just that: a sample. It was lacking in some regards and so a plethora of variants popped up, all with varying version numbers. But all these version numbers do is to mask the fact that these are not &#8220;official&#8221; versions of sanctioned Apple code. Yet another problem is that people needed to start prefixing their versions of Reachability as to avoid conflicts with other people&#8217;s Reachability contained in other components. For the latest version of AutoIngest for Mac I wanted to understand the core of what is necessary to do monitoring of the Internet connection. And then develop my own reachability solution that does not have this baggage. Something that I could include in all my projects via DTFoundation without having to fear linker conflicts or code duplication. As a starting point, to understand the basic concepts, I turned to Erica Sadun&#8217;s UIDevice (Reachability) category which is bold in its own right, since it is one of very few pieces of code that don&#8217;t trace their lineage back to Apple&#8217;s Reachability sample. SystemConfiguration Basics The main reason for Reachability&#8217;s popularity is that there is no Objective-C API for achieving connection monitoring. You have to go down to the Core Foundation level, where you find all the necessary C-functions for this purpose. All Objective-C Reachability derivatives are basically wrappers around SCNetworkReachability. What follows are the basic ingredients to use SCNetworkReachability, which I shall abbreviate as SCNR henceforth. First you need to define a call-back function that will be called by SCNR whenever there is a change in network status. This function gets are reference to the SCNR instance, SCNetworkConnectionFlags informing about the status and a void * info pointer which you can use to keep track of some state or context. static void ReachabilityCallback&#40;SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void* info&#41; &#123; // do something with the flags &#125; The second step is to define the addresses that this SCNR will be watching for. BOOL ignoresAdHocWiFi = NO; &#160; struct sockaddr_in ipAddress; bzero&#40;&#38;ipAddress, sizeof&#40;ipAddress&#41;&#41;; ipAddress.sin_len = sizeof&#40;ipAddress&#41;; ipAddress.sin_family = AF_INET; ipAddress.sin_addr.s_addr = htonl&#40;ignoresAdHocWiFi ? INADDR_ANY : IN_LINKLOCALNETNUM&#41;; Erica has got this BOOL value ignoresAdHocWiFi which you can set to YES if you are not interested in those kinds of connections. The third step is to create an SCNR instance, set the callback function and schedule it on a run loop. // create a reachability _reachability = SCNetworkReachabilityCreateWithAddress&#40;kCFAllocatorDefault, &#40;struct sockaddr *&#41;&#38;ipAddress&#41;; &#160; // create a context, this gets passed to function as info SCNetworkReachabilityContext context = &#123;0, NULL, NULL, NULL, NULL&#125;; &#160; // set callback function if &#40;SCNetworkReachabilitySetCallback&#40;_reachability, ReachabilityCallback, &#38;context&#41;&#41; &#123; if &#40;!SCNetworkReachabilityScheduleWithRunLoop&#40;_reachability, CFRunLoopGetMain&#40;&#41;, kCFRunLoopCommonModes&#41;&#41; &#123; NSLog&#40;@&#34;Error: Could not schedule reachability&#34;&#41;; &#160; // something went wrong, unset callback SCNetworkReachabilitySetCallback&#40;_reachability, NULL, NULL&#41;; &#160; return nil; &#125; &#125; Note that we are choosing to schedule the SCNR on the main run loop and the common modes. The main run loop is the only one we can rely on to be present, the common modes means that it does not get paused if we scroll a UIScrollView. With the SCNR successfully scheduled we could either wait for the next change in flags to trigger our call back function. Or we can always get the current state with SCNetworkReachabilityGetFlags. // get the current flags if possible if &#40;SCNetworkReachabilityGetFlags&#40;_reachability, &#38;_connectionFlags&#41;&#41; &#123; // we got flags, do something with it &#125; To clean up, we unset the call back function and unschedule the SCNR. SCNetworkReachabilitySetCallback&#40;_reachability, NULL, NULL&#41;; &#160; if &#40;SCNetworkReachabilityUnscheduleFromRunLoop&#40;_reachability, CFRunLoopGetMain&#40;&#41;, kCFRunLoopCommonModes&#41;&#41; &#123; NSLog&#40;@&#34;Unscheduled reachability&#34;&#41;; &#125; else &#123; NSLog&#40;@&#34;Error: Could not unschedule reachability&#34;&#41;; &#125; &#160; // this is CF, so we need to nil our IVAR _reachability = nil; These are the basic ingredients for our own Reachability. Block-based Reachability With these basic parts down, I created DTReachability for inclusion in my DTFoundation toolkit, with this API: // observer block typedef void&#40;^DTReachabilityObserverBlock&#41;&#40;SCNetworkConnectionFlags connectionFlags&#41;; &#160; @interface DTReachability : NSObject &#160; /** Adds a block to observe network reachability. Every time the reachability flags change this block is invoked. Also once right after adding the observer with the current state. @param observer An observation block @returns An opaque reference to the observer which you can use to remove it */ + &#40;id&#41;addReachabilityObserverWithBlock:&#40;DTReachabilityObserverBlock&#41;observer; &#160; &#160; /** Removes a reachability observer. @param observer The opaque reference to a reachability observer */ + &#40;void&#41;removeReachabilityObserver:&#40;id&#41;observer; &#160; @end The observer is a block that receives the current connection flags. You can add reachability observers for any object in your code via the class method to add them. Internally DTReachability keeps these observers in a mutable set and uses a single SCNR to service these. Similar to the block-based API for NSNotificationCenter you receive back an opaque reference from the registration which you can use later on [...]]]></description>
				<content:encoded><![CDATA[<p>The Reachability sample is arguable the one piece of Apple sample code that is seen in most wide use. But it is just that: a sample.</p>
<p>It was lacking in some regards and so a plethora of variants popped up, all with varying version numbers. But all these version numbers do is to mask the fact that these are not &#8220;official&#8221; versions of sanctioned Apple code.</p>
<p>Yet another problem is that people needed to start prefixing their versions of Reachability as to avoid conflicts with other people&#8217;s Reachability contained in other components.</p>
<p><span id="more-8175"></span></p>
<div id="more-8175"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>For the latest version of AutoIngest for Mac I wanted to understand the core of what is necessary to do monitoring of the Internet connection. And then develop my own reachability solution that does not have this baggage. Something that I could include in all my projects via DTFoundation without having to fear linker conflicts or code duplication.</p>
<p>As a starting point, to understand the basic concepts, I turned to Erica Sadun&#8217;s <a href="https://github.com/erica/uidevice-extension/blob/master/UIDevice-Reachability.m">UIDevice (Reachability)</a> category which is bold in its own right, since it is one of very few pieces of code that don&#8217;t trace their lineage back to Apple&#8217;s Reachability sample.</p>
<h4>SystemConfiguration Basics</h4>
<p>The main reason for Reachability&#8217;s popularity is that there is no Objective-C API for achieving connection monitoring. You have to go down to the Core Foundation level, where you find all the necessary C-functions for this purpose. All Objective-C Reachability derivatives are basically wrappers around <strong>SCNetworkReachability</strong>.</p>
<p>What follows are the basic ingredients to use SCNetworkReachability, which I shall abbreviate as SCNR henceforth.</p>
<p>First you need to define a call-back function that will be called by SCNR whenever there is a change in network status. This function gets are reference to the SCNR instance, SCNetworkConnectionFlags informing about the status and a void * info pointer which you can use to keep track of some state or context.</p>

<div class="wp_codebox"><table><tr id="p817536"><td class="code" id="p8175code36"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">static</span> <span style="color: #a61390;">void</span> ReachabilityCallback<span style="color: #002200;">&#40;</span>SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, <span style="color: #a61390;">void</span><span style="color: #002200;">*</span> info<span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
   <span style="color: #11740a; font-style: italic;">// do something with the flags</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>The second step is to define the addresses that this SCNR will be watching for.</p>

<div class="wp_codebox"><table><tr id="p817537"><td class="code" id="p8175code37"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">BOOL</span> ignoresAdHocWiFi <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
<span style="color: #a61390;">struct</span> sockaddr_in ipAddress;
bzero<span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>ipAddress, <a href="http://www.opengroup.org/onlinepubs/009695399/functions/sizeof.html"><span style="color: #a61390;">sizeof</span></a><span style="color: #002200;">&#40;</span>ipAddress<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
ipAddress.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>ipAddress<span style="color: #002200;">&#41;</span>;
ipAddress.sin_family <span style="color: #002200;">=</span> AF_INET;
ipAddress.sin_addr.s_addr <span style="color: #002200;">=</span> htonl<span style="color: #002200;">&#40;</span>ignoresAdHocWiFi ? INADDR_ANY <span style="color: #002200;">:</span> IN_LINKLOCALNETNUM<span style="color: #002200;">&#41;</span>;</pre></td></tr></table></div>

<p>Erica has got this BOOL value ignoresAdHocWiFi which you can set to YES if you are not interested in those kinds of connections.</p>
<p>The third step is to create an SCNR instance, set the callback function and schedule it on a run loop.</p>

<div class="wp_codebox"><table><tr id="p817538"><td class="code" id="p8175code38"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// create a reachability</span>
_reachability <span style="color: #002200;">=</span> SCNetworkReachabilityCreateWithAddress<span style="color: #002200;">&#40;</span>kCFAllocatorDefault, <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>ipAddress<span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// create a context, this gets passed to function as info</span>
SCNetworkReachabilityContext context <span style="color: #002200;">=</span> <span style="color: #002200;">&#123;</span><span style="color: #2400d9;">0</span>, <span style="color: #a61390;">NULL</span>, <span style="color: #a61390;">NULL</span>, <span style="color: #a61390;">NULL</span>, <span style="color: #a61390;">NULL</span><span style="color: #002200;">&#125;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// set callback function        </span>
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>SCNetworkReachabilitySetCallback<span style="color: #002200;">&#40;</span>_reachability, ReachabilityCallback, <span style="color: #002200;">&amp;</span>context<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>SCNetworkReachabilityScheduleWithRunLoop<span style="color: #002200;">&#40;</span>_reachability, CFRunLoopGetMain<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>, kCFRunLoopCommonModes<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
   <span style="color: #002200;">&#123;</span>
      NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Error: Could not schedule reachability&quot;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
      <span style="color: #11740a; font-style: italic;">// something went wrong, unset callback</span>
      SCNetworkReachabilitySetCallback<span style="color: #002200;">&#40;</span>_reachability, <span style="color: #a61390;">NULL</span>, <span style="color: #a61390;">NULL</span><span style="color: #002200;">&#41;</span>;
&nbsp;
      <span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>;
   <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>Note that we are choosing to schedule the SCNR on the main run loop and the common modes. The main run loop is the only one we can rely on to be present, the common modes means that it does not get paused if we scroll a UIScrollView.</p>
<p>With the SCNR successfully scheduled we could either wait for the next change in flags to trigger our call back function. Or we can always get the current state with <strong>SCNetworkReachabilityGetFlags</strong>.</p>

<div class="wp_codebox"><table><tr id="p817539"><td class="code" id="p8175code39"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// get the current flags if possible</span>
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>SCNetworkReachabilityGetFlags<span style="color: #002200;">&#40;</span>_reachability, <span style="color: #002200;">&amp;</span>_connectionFlags<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
   <span style="color: #11740a; font-style: italic;">// we got flags, do something with it</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>To clean up, we unset the call back function and unschedule the SCNR.</p>

<div class="wp_codebox"><table><tr id="p817540"><td class="code" id="p8175code40"><pre class="objc" style="font-family:monospace;">SCNetworkReachabilitySetCallback<span style="color: #002200;">&#40;</span>_reachability, <span style="color: #a61390;">NULL</span>, <span style="color: #a61390;">NULL</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>SCNetworkReachabilityUnscheduleFromRunLoop<span style="color: #002200;">&#40;</span>_reachability, CFRunLoopGetMain<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>, kCFRunLoopCommonModes<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
   NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Unscheduled reachability&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #a61390;">else</span>
<span style="color: #002200;">&#123;</span>
   NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Error: Could not unschedule reachability&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// this is CF, so we need to nil our IVAR</span>
_reachability <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;</pre></td></tr></table></div>

<p>These are the basic ingredients for our own Reachability.</p>
<h3>Block-based Reachability</h3>
<p>With these basic parts down, I created <b>DTReachability</b> for inclusion in my DTFoundation toolkit, with this API:</p>

<div class="wp_codebox"><table><tr id="p817541"><td class="code" id="p8175code41"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// observer block</span>
<span style="color: #a61390;">typedef</span> <span style="color: #a61390;">void</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">^</span>DTReachabilityObserverBlock<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#40;</span>SCNetworkConnectionFlags connectionFlags<span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #a61390;">@interface</span> DTReachability <span style="color: #002200;">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a>
&nbsp;
<span style="color: #11740a; font-style: italic;">/**
 Adds a block to observe network reachability. Every time the reachability flags change this block is invoked. Also once right after adding the observer with the current state.
 @param observer An observation block
 @returns An opaque reference to the observer which you can use to remove it
 */</span>
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>addReachabilityObserverWithBlock<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>DTReachabilityObserverBlock<span style="color: #002200;">&#41;</span>observer;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">/**
 Removes a reachability observer.
 @param observer The opaque reference to a reachability observer
 */</span>
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>removeReachabilityObserver<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>observer;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>The observer is a block that receives the current connection flags. You can add reachability observers for any object in your code via the class method to add them.</p>
<p>Internally DTReachability keeps these observers in a mutable set and uses a single SCNR to service these. Similar to the block-based API for NSNotificationCenter you receive back an opaque reference from the registration which you can use later on to unregister the observer.</p>
<p>Upon registration of an observer the class also tries to immediately get the current network flags and if successful calls the observer block right away with these.</p>
<p>Here&#8217;s is how this is used in AutoIngest for Mac:</p>

<div class="wp_codebox"><table><tr id="p817542"><td class="code" id="p8175code42"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// make a weak ref</span>
__weak DTITCReportManager <span style="color: #002200;">*</span>weakself <span style="color: #002200;">=</span> self;
&nbsp;
_reachabilityObserver <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>DTReachability addReachabilityObserverWithBlock<span style="color: #002200;">:^</span><span style="color: #002200;">&#40;</span>SCNetworkConnectionFlags connectionFlags<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
&nbsp;
   <span style="color: #11740a; font-style: italic;">// assign to strong first</span>
   DTITCReportManager <span style="color: #002200;">*</span>manager <span style="color: #002200;">=</span> weakself;
&nbsp;
   <span style="color: #11740a; font-style: italic;">// store current network flags</span>
   manager<span style="color: #002200;">-</span>&gt;_connectionFlags <span style="color: #002200;">=</span> connectionFlags;
&nbsp;
   <span style="color: #a61390;">BOOL</span> hasConnection <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>manager _hasInternetConnection<span style="color: #002200;">&#93;</span>;
&nbsp;
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>hasConnection<span style="color: #002200;">&#41;</span>
   <span style="color: #002200;">&#123;</span>
      NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Has Internet Connection&quot;</span><span style="color: #002200;">&#41;</span>;
   <span style="color: #002200;">&#125;</span>
   <span style="color: #a61390;">else</span>
   <span style="color: #002200;">&#123;</span>
      NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;NO Internet Connection&quot;</span><span style="color: #002200;">&#41;</span>;
   <span style="color: #002200;">&#125;</span>
&nbsp;
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>manager<span style="color: #002200;">-</span>&gt;_waitingForConnectionToSync <span style="color: #002200;">&amp;&amp;</span> hasConnection<span style="color: #002200;">&#41;</span>
   <span style="color: #002200;">&#123;</span>
      NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Internet became available and waiting for that to sync&quot;</span><span style="color: #002200;">&#41;</span>;
      <span style="color: #002200;">&#91;</span>manager startSync<span style="color: #002200;">&#93;</span>;
   <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>This uses a helper method _hasInternetConnect which inspects the current network flags to determine if internet is connected:</p>

<div class="wp_codebox"><table><tr id="p817543"><td class="code" id="p8175code43"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>_hasInternetConnection
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">BOOL</span> isReachable <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>_connectionFlags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsReachable<span style="color: #002200;">&#41;</span> <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #a61390;">BOOL</span> needsConnection <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>_connectionFlags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsConnectionRequired<span style="color: #002200;">&#41;</span> <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
    <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: #002200;">&#125;</span></pre></td></tr></table></div>

<p>Note that we have to convert the weak reference to a strong one first in the block. The reason for this is that weak references might turn to nil during execution of the block. And dereferences a public IVAR from a NULL causes a runtime exception. Also Xcode will alert us to that fact. </p>
<p>As an alternative we could have created a private setter. There it would not have mattered if the references became nil since you can always message nil with anything and it will be a no-op.</p>
<h3>Conclusion</h3>
<p>I like this block-based approach much more as opposed to listening for notifications or having a delegate callback on a central Reachability instance. </p>
<p>In most uses-cases I have seen so far you are probably just calling a method on the watching view controller and there it helps that the observer block can capture some state. Because of this we don&#8217;t need to use the C-level state passing.</p>
<p>At the time of this writing the code for DTReachability is now present on the develop branch of DTFoundation, it will be merged into master for the next release. Since it has a dependency on the SystemConfiguration.framework I put it into its own static lib and Cocoapods sub spec to use individually.</p>
<p>I am using this in AutoIngest for Mac now, but it should work without modification on iOS just the same. Your feedback is welcome.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8175&amp;md5=0af2f00d32cba77f347822d14896d172" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/simple-reachability-blocks/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fsimple-reachability-blocks%2F&amp;language=en_GB&amp;category=text&amp;title=Simple+Reachability+%2B+Blocks&amp;description=The+Reachability+sample+is+arguable+the+one+piece+of+Apple+sample+code+that+is+seen+in+most+wide+use.+But+it+is+just+that%3A+a+sample.+It+was+lacking+in...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>AutoIngest for Mac 0.4.1</title>
		<link>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-1/</link>
		<comments>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-1/#comments</comments>
		<pubDate>Sat, 11 May 2013 12:44:46 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Administrative]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8172</guid>
		<description><![CDATA[Sorry, but some bugs had crept into yesterday&#8217;s release of AutoIngest for Mac. So we fixed them. Changes FIXED: Crash if report download folder had spaces FIXED: Auto-Organizer was watching non-existent folder FIXED: Uncompressing files did not remove .gz extension FIXED: Menu Option was not modified if Auto-Sync was occurring We have already been able to verify that Newsstand report downloading works. Though we still are looking for somebody who has Opt-In reports to help us see if the downloading works for these as well. I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, direct download as well as full source on GitHub. The binary builds have Sparkle for OTA updating and are signed with Developer ID.]]></description>
				<content:encoded><![CDATA[<p>Sorry, but some bugs had crept into <a title="AutoIngest for Mac 0.4.0" href="http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-0/">yesterday&#8217;s release</a> of AutoIngest for Mac. So we fixed them.</p>
<p><span id="more-8172"></span></p>
<div id="more-8172"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Changes</h3>
<ul>
<li><span style="line-height: 13px;">FIXED: Crash if report download folder had spaces</span></li>
<li>FIXED: Auto-Organizer was watching non-existent folder</li>
<li>FIXED: Uncompressing files did not remove .gz extension</li>
<li>FIXED: Menu Option was not modified if Auto-Sync was occurring</li>
</ul>
<p>We have already been able to verify that <strong>Newsstand report downloading works</strong>. Though we still are looking for somebody who has <strong>Opt-In</strong> reports to help us see if the downloading works for these as well.</p>
<p>I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, <a href="http://beta.cocoanetics.com/Cocoanetics/com.cocoanetics.AutoIngest/56/AutoIngest.zip">direct download</a> as well as full source <a href="https://github.com/Cocoanetics/AutoIngest">on GitHub</a>. The binary builds have Sparkle for OTA updating and are signed with Developer ID.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8172&amp;md5=ad0cf8fd781a312c11800d78bf417810" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fautoingest-for-mac-0-4-1%2F&amp;language=en_GB&amp;category=text&amp;title=AutoIngest+for+Mac+0.4.1&amp;description=Sorry%2C+but+some+bugs+had+crept+into+yesterday%26%238217%3Bs+release+of+AutoIngest+for+Mac.+So+we+fixed+them.+Changes+FIXED%3A+Crash+if+report+download+folder+had+spaces+FIXED%3A+Auto-Organizer+was+watching...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>AutoIngest for Mac 0.4.0</title>
		<link>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-0/</link>
		<comments>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-0/#comments</comments>
		<pubDate>Fri, 10 May 2013 13:07:24 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8155</guid>
		<description><![CDATA[This is the forth release of our handy little status bar app for downloading iTunes Connect reports to your hard disk. I want to specifically highlight the new option to have your downloaded reports be automatically organized into folders for you, thanks to Felipe Cypriano. Jan Weiß and Christian Pfandler collaborated on the new golden Apple Icon. The idea behind this &#8211; besides the reference to Apple, Inc. &#8211; is that apps are your golden Apples and this app is good for you because it lets you take a bite of this value. Changes ADDED: Option to automatically organize reports in folders by vendor id, type, sub type and date type ADDED: App Icon ADDED: Options for downloading Opt-in and Newsstand reports ADDED: Notification Center message now shows number of downloaded reports by type FIXED: Sync Now menu option wasn&#8217;t disabled if sync was impossible to do missing or wrong account info We now also enabled (theoretically) downloading of the other report types offered by Apple&#8217;s API: Opt-In and Newsstand. This gives you a great overview over what kinds of reports are possible. These combinations are mentioned in the iTunes Connect Reporting Guide as well as have been verified to exist by 2 people who have apps that produce these kinds of reports. Please Help if You have Newsstand or Opt-In Reports I have no ability to test these I have to rely on users who are willing to try this out. And preferably also fix it via pull request or by joining the team of developers. There is a known issue with Opt-In reports. Those are zipped with a password and for the time being we have no ability to unzip these. Again this would require help of a developer who has Opt-In reports to test on. One feature that I would like to also add is support for adding multiple accounts/vendors and there you would also have a box to enter the Opt-In unzip password. I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, direct download as well as full source on GitHub. The binary builds have Sparkle for OTA updating and are signed with Developer ID.]]></description>
				<content:encoded><![CDATA[<p>This is the forth release of our handy little status bar app for downloading iTunes Connect reports to your hard disk.</p>
<p>I want to specifically highlight the new option to have your downloaded reports be automatically organized into folders for you, thanks to <a href="https://github.com/fcy">Felipe Cypriano</a>.</p>
<p>Jan Weiß and Christian Pfandler collaborated on the new golden Apple Icon. The idea behind this &#8211; besides the reference to Apple, Inc. &#8211; is that apps are your golden Apples and this app is good for you because it lets you take a bite of this value.</p>
<p><span id="more-8155"></span></p>
<div id="more-8155"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Changes</h3>
<ul>
<li>ADDED: Option to automatically organize reports in folders by vendor id, type, sub type and date type</li>
<li>ADDED: App Icon</li>
<li>ADDED: Options for downloading Opt-in and Newsstand reports</li>
<li>ADDED: Notification Center message now shows number of downloaded reports by type</li>
<li>FIXED: Sync Now menu option wasn&#8217;t disabled if sync was impossible to do missing or wrong account info</li>
</ul>
<p>We now also enabled (theoretically) downloading of the other report types offered by Apple&#8217;s API: <strong>Opt-In and Newsstand</strong>.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-10-at-14.49.49.png"><img class="alignnone size-full wp-image-8158" alt="New Reports Tab" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-10-at-14.49.49.png?resize=594%2C438" data-recalc-dims="1" /></a></p>
<p>This gives you a great overview over what kinds of reports are possible. These combinations are mentioned in the iTunes Connect Reporting Guide as well as have been verified to exist by 2 people who have apps that produce these kinds of reports.</p>
<h3>Please Help if You have Newsstand or Opt-In Reports</h3>
<p>I have no ability to test these I have to rely on users who are willing to try this out. And preferably also fix it via pull request or by joining the team of developers.</p>
<p>There is a known issue with Opt-In reports. Those are zipped with a password and for the time being we have no ability to unzip these. Again this would require help of a developer who has Opt-In reports to test on. One feature that I would like to also add is support for adding multiple accounts/vendors and there you would also have a box to enter the Opt-In unzip password.</p>
<p>I hope you are enjoying this new version AutoIngest for Mac! It is available via auto-update, <a href="http://beta.cocoanetics.com/Cocoanetics/com.cocoanetics.AutoIngest/55/AutoIngest.zip">direct download</a> as well as full source <a href="https://github.com/Cocoanetics/AutoIngest">on GitHub</a>. The binary builds have Sparkle for OTA updating and are signed with Developer ID.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8155&amp;md5=c33b4c3fb69db3dfb958cab7844c15a2" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-4-0/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fautoingest-for-mac-0-4-0%2F&amp;language=en_GB&amp;category=text&amp;title=AutoIngest+for+Mac+0.4.0&amp;description=This+is+the+forth+release+of+our+handy+little+status+bar+app+for+downloading+iTunes+Connect+reports+to+your+hard+disk.+I+want+to+specifically+highlight+the+new+option+to...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>My Radar Samples Collection</title>
		<link>http://www.cocoanetics.com/2013/05/my-radar-samples-collection/</link>
		<comments>http://www.cocoanetics.com/2013/05/my-radar-samples-collection/#comments</comments>
		<pubDate>Thu, 09 May 2013 19:50:12 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8151</guid>
		<description><![CDATA[I scoured through the Cocoanetics blog for all the individual ZIP files of sample apps that I had made to accompany some of my Apple bug reports. I like to create a fresh project for each bug to demonstrate, so these sample apps don&#8217;t contain anything that I would not want to be public. The samples can be categorized into: Open, Fixed and Not a Bug. For the ones that got fixed I also mention as of which iOS version. These samples serve as a nice reminder how much more likely Apple engineers are fixing reported bugs if you can provide them a quick to grasp example demonstrating the issue. Sometimes I get lazy, especially when I am betting that I am probably not the first to report the issue and when I can be reasonably certain that the issue is not in my own code. Then I don&#8217;t do a sample right away. When the response then is that my bug report is a Duplicate then my bet was correct. If not, then you get an email stating: This is a courtesy email regarding Bug ID# 13836932. Engineering has requested the following information in order to further investigate this issue: Please attach a sample app that demonstrates this issue to your bug report. At this point I kick into high gear and whip up a sample like the ones you can find in my Radar Samples Collection on GitHub. The point of these apps is to demonstrate to yourself that the bug still occurs in a fresh app that came nowhere near your other apps. That it is not a Heisenbug. And to demonstrate to an Apple engineer straight and to the point what the issue is about. At WWDC 2012 a senior Apple engineer told me that bug reports that he cannot quickly reproduce (with the help of a sample) will go to the bottom of the stack. The have little chance of being acted upon until many others report the same issue and provide better reproducibility. Long story short: File good bugs and for the ones that are not Duplicates make exceptionally simple and self-explanatory samples.]]></description>
				<content:encoded><![CDATA[<p>I scoured through the Cocoanetics blog for all the individual ZIP files of sample apps that I had made to accompany some of my Apple bug reports.</p>
<p><span id="more-8151"></span></p>
<div id="more-8151"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>I like to create a fresh project for each bug to demonstrate, so these sample apps don&#8217;t contain anything that I would not want to be public.</p>
<p>The samples can be categorized into: Open, Fixed and Not a Bug. For the ones that got fixed I also mention as of which iOS version.</p>
<p>These samples serve as a nice reminder how much more likely Apple engineers are fixing reported bugs if you can provide them a quick to grasp example demonstrating the issue.</p>
<p>Sometimes I get lazy, especially when I am betting that I am probably not the first to report the issue and when I can be reasonably certain that the issue is not in my own code. Then I don&#8217;t do a sample right away. When the response then is that my bug report is a Duplicate then my bet was correct.</p>
<p>If not, then you get an email stating:</p>
<blockquote><p>This is a courtesy email regarding Bug ID# 13836932.</p>
<p>Engineering has requested the following information in order to further investigate this issue:</p>
<p>Please attach a sample app that demonstrates this issue to your bug report.</p></blockquote>
<p>At this point I kick into high gear and whip up a sample like the ones you can find in my <a href="https://github.com/Cocoanetics/RadarSamples">Radar Samples Collection on GitHub</a>.</p>
<p>The point of these apps is to demonstrate to yourself that the bug still occurs in a fresh app that came nowhere near your other apps. That it is not a <a href="http://en.wikipedia.org/wiki/Heisenbug">Heisenbug</a>. And to demonstrate to an Apple engineer straight and to the point what the issue is about.</p>
<p>At WWDC 2012 a senior Apple engineer told me that bug reports that he cannot quickly reproduce (with the help of a sample) will go to the bottom of the stack. The have little chance of being acted upon until many others report the same issue and provide better reproducibility.</p>
<p>Long story short: File good bugs and for the ones that are not Duplicates make exceptionally simple and self-explanatory samples.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8151&amp;md5=1cb3a00438d710b6a7089fea225c512a" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/my-radar-samples-collection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fmy-radar-samples-collection%2F&amp;language=en_GB&amp;category=text&amp;title=My+Radar+Samples+Collection&amp;description=I+scoured+through+the+Cocoanetics+blog+for+all+the+individual+ZIP+files+of+sample+apps+that+I+had+made+to+accompany+some+of+my+Apple+bug+reports.+I+like+to...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Rich Text Update 1.5</title>
		<link>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/</link>
		<comments>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/#comments</comments>
		<pubDate>Wed, 08 May 2013 16:22:41 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[DTCoreText]]></category>
		<category><![CDATA[DTLoupeView]]></category>
		<category><![CDATA[DTRichTextEditor]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8145</guid>
		<description><![CDATA[Today we are releasing the 1.5 version of our rich text components. This marks the second unified release where several parts of our rich text eco system are maturing in lock-step. For the most part these improvements and enhancements were funded from exceptional sales of DTRichTextEditor as well as several sponsors who stepped forward to allow me to finally get support for lists implemented. From what I can tell the clients who licensed the editor are way more willing to contribute funds to something they have already paid for, than for enhancing the &#8211; otherwise free with attribution &#8211; DTCoreText. Here are the collected release notes: DTRichTextEditor 1.5 ADDED: Implemented Support for Ordered and Unordered Lists, editable 1 level CHANGED: Improved handling of nested lists ADDED: Method to set text color for range ADDED: Method to set strikethrough style for range ADDED: HTMLStringWithOptions methods ADDED: Ability to animate between input views (custom keyboards) FIXED: style information would not obey custom CSS stylesheet in textDefaults CHANGED: editing delegate now uses editorView:shouldChangeTextInRange:replacementText: for image pasting ADDED: [DEMO] Formatting View Controller, shown as popover on iPad and input view on iPhone Online Documentation DTCoreText 1.5 ADDED: Methods for getting glyph path for glyph runs and lines CHANGED: DTTextAttachment is now a class cluster ADDED: Custom text attachments can now opt to participate in inline drawing and/or HTML output FIXED: Loading of font table made asynchronously FIXED: Fonts that have a synthetic slant matrix cause text to disappear FIXED: Shadow:none causes text to disappear FIXED: CSS Attributes were not case-sensitive FIXED: Issue with setting color of HR FIXED: Problems with nested list parsing and DTHTMLWriter output FIXED: HTTPS URLS in web video view where treated as external URLs FIXED: Bug where text attributes would &#8220;bleed&#8221; into the paragraph break Online Documentation DTLoupe 1.5 ADDED: sanity check to avoid rare NAN crash Online Documentation There is also now a Programming Guide for DTRichTextEditor where I&#8217;m collecting guides how to implement frequently asked about things. I especially would like to thank Lee Hericks for his work on the backend and help with polishing, as well as Daniel Phillips who helped implement the format picker in the Editor demo. Here&#8217;s a screenshot. &#160; Of course work has already begun on the next version. If you need something specific implemented please get in touch.]]></description>
				<content:encoded><![CDATA[<p>Today we are releasing the 1.5 version of our rich text components. This marks the second unified release where several parts of our rich text eco system are maturing in lock-step.</p>
<p>For the most part these improvements and enhancements were funded from exceptional sales of <a href="http://www.cocoanetics.com/parts/dtrichtexteditor/">DTRichTextEditor</a> as well as several sponsors who stepped forward to allow me to finally get <strong>support for lists</strong> implemented.</p>
<p>From what I can tell the clients who licensed the editor are way more willing to contribute funds to something they have already paid for, than for enhancing the &#8211; otherwise free with attribution &#8211; DTCoreText.</p>
<p><span id="more-8145"></span></p>
<div id="more-8145"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Here are the collected release notes:</p>
<h3>DTRichTextEditor 1.5</h3>
<ul>
<li>ADDED: Implemented Support for Ordered and Unordered Lists, editable 1 level</li>
<li>CHANGED: Improved handling of nested lists</li>
<li>ADDED: Method to set text color for range</li>
<li>ADDED: Method to set strikethrough style for range</li>
<li>ADDED: HTMLStringWithOptions methods</li>
<li>ADDED: Ability to animate between input views (custom keyboards)</li>
<li>FIXED: style information would not obey custom CSS stylesheet in textDefaults</li>
<li>CHANGED: editing delegate now uses editorView:shouldChangeTextInRange:replacementText: for image pasting</li>
<li>ADDED: [DEMO] Formatting View Controller, shown as popover on iPad and input view on iPhone</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTRichTextEditor/">Online Documentation</a></p>
<h3>DTCoreText 1.5</h3>
<ul>
<li>ADDED: Methods for getting glyph path for glyph runs and lines</li>
<li>CHANGED: DTTextAttachment is now a class cluster</li>
<li>ADDED: Custom text attachments can now opt to participate in inline drawing and/or HTML output</li>
<li>FIXED: Loading of font table made asynchronously</li>
<li>FIXED: Fonts that have a synthetic slant matrix cause text to disappear</li>
<li>FIXED: Shadow:none causes text to disappear</li>
<li>FIXED: CSS Attributes were not case-sensitive</li>
<li>FIXED: Issue with setting color of HR</li>
<li>FIXED: Problems with nested list parsing and DTHTMLWriter output</li>
<li>FIXED: HTTPS URLS in web video view where treated as external URLs</li>
<li>FIXED: Bug where text attributes would &#8220;bleed&#8221; into the paragraph break</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTCoreText/">Online Documentation</a></p>
<h3>DTLoupe 1.5</h3>
<ul>
<li>ADDED: sanity check to avoid rare NAN crash</li>
</ul>
<p><a href="https://docs.cocoanetics.com/DTLoupeView/">Online Documentation</a></p>
<p>There is also now a <a href="https://docs.cocoanetics.com/DTRichTextEditor/docs/Programming%20Guide.html">Programming Guide for DTRichTextEditor</a> where I&#8217;m collecting guides how to implement frequently asked about things.</p>
<p>I especially would like to thank <strong>Lee Hericks</strong> for his work on the backend and help with polishing, as well as <a href="http://twitter.com/Daniel_J_P">Daniel Phillips</a> who helped implement the format picker in the Editor demo. Here&#8217;s a screenshot.</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-08-at-18.04.29.png"><img class="alignnone  wp-image-8146" alt="DTRichTextEditor 1.5" src="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-08-at-18.04.29.png?resize=622%2C819" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>Of course work has already begun on the next version. If you need something specific implemented please <a href="mailto:oliver@cocoanetics.com">get in touch</a>.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8145&amp;md5=b1da5aec26aa5de61595157ccfce438e" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/rich-text-update-1-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Frich-text-update-1-5%2F&amp;language=en_GB&amp;category=text&amp;title=Rich+Text+Update+1.5&amp;description=Today+we+are+releasing+the+1.5+version+of+our+rich+text+components.+This+marks+the+second+unified+release+where+several+parts+of+our+rich+text+eco+system+are+maturing+in...&amp;tags=DTCoreText%2CDTLoupeView%2CDTRichTextEditor%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Radar: UIScrollView Should Not Adjust Content Inset if it is Input View</title>
		<link>http://www.cocoanetics.com/2013/05/radar-uiscrollview-should-not-adjust-content-inset-if-it-is-input-view/</link>
		<comments>http://www.cocoanetics.com/2013/05/radar-uiscrollview-should-not-adjust-content-inset-if-it-is-input-view/#comments</comments>
		<pubDate>Wed, 08 May 2013 11:17:59 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Bug Reports]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8141</guid>
		<description><![CDATA[While working on the demo app for my DTRichTextEditor I stumbled across a bug that exists since iOS 6. You&#8217;ll notice that only if you set an inputView on an editable UIView and have it become first Responder. Filed as rdar://13836932 and on OpenRadar. Update May 9th: Provided a Sample App, which is also available on GitHub. Summary You can set a view as inputView for a editable view to appear in place of a keyboard. If this inputView has a scroll view this will erroneously receive a setContentInset after the keyboard finished its incoming animation. Steps to Reproduce Create a UITableViewController On a UIView that canBecomeFirstResponder set this VC&#8217;s view as inputView have the UIView becomeFirstResponder Expected Results The UITableViewController&#8217;s tableView should not have a contentInset Actual Results Every UIScrollView receives a contentInset, even if it is itself the inputView that was showing &#8220;as keyboard&#8221;. Regression This automatic setting of contentInset started with iOS 6. It does not occur in iOS 5. Notes I believe that the notification that gets sent after the keyboard/inputView animated in should take into consideration that scroll views that are subviews of the showing inputView don&#8217;t get a contentInset set. As a workaround I am subclassing UITableView and overriding setContentInset: to ignore the erroneous setting. This is the call stack I get on this overwritten contentInset: * thread #1: tid = 0x1c03, 0x0000f6ca RTEDemoApp`-[DTFormatTableView setContentInset:](self=0x099e5000, _cmd=0x09405f60, contentInset=(null)) + 58 at DTFormatTableView.m:16, stop reason = breakpoint 3.1 frame #0: 0x0000f6ca RTEDemoApp`-[DTFormatTableView setContentInset:](self=0x099e5000, _cmd=0x09405f60, contentInset=(null)) + 58 at DTFormatTableView.m:16 frame #1: 0x0373c1bd CoreFoundation`__invoking___ + 29 frame #2: 0x0373c0d6 CoreFoundation`-[NSInvocation invoke] + 342 frame #3: 0x016c7def Foundation`NSKVOForwardInvocation + 375 frame #4: 0x03737cf9 CoreFoundation`___forwarding___ + 905 frame #5: 0x0373794e CoreFoundation`_CF_forwarding_prep_0 + 14 frame #6: 0x00bc5029 UIKit`-[UIScrollView(UIScrollViewInternal) _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] + 377 frame #7: 0x00c14ddc UIKit`-[UITableView(UITableViewInternal) _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] + 73 frame #8: 0x00d87af9 UIKit`-[UITableViewController _adjustTableForKeyboardInfo:] + 201 frame #9: 0x00d86c27 UIKit`-[UITableViewControllerKeyboardSupport _keyboardDidChangeFrame:] + 131 frame #10: 0x016d44f9 Foundation`__57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 40 frame #11: 0x037a20c5 CoreFoundation`___CFXNotificationPost_block_invoke_0 + 85 frame #12: 0x036fcefa CoreFoundation`_CFXNotificationPost + 2122 frame #13: 0x01608bb2 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 98 frame #14: 0x00f08a29 UIKit`-[UIInputViewTransition postNotificationsForTransitionEnd] + 682 frame #15: 0x00f01e5c UIKit`__53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke_01079 + 203 frame #16: 0x00ba2df6 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 223 frame #17: 0x00b95d66 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 237 frame #18: 0x00b95f04 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 68 frame #19: 0x006a57d8 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 284 frame #20: 0x01ff0014 libdispatch.dylib`_dispatch_client_callout + 14 frame #21: 0x01fe07d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296 frame #22: 0x036eeaf5 CoreFoundation`__CFRunLoopRun + 1925 frame #23: 0x036edf44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #24: 0x036ede1b CoreFoundation`CFRunLoopRunInMode + 123 frame #25: 0x02b757e3 GraphicsServices`GSEventRunModal + 88 frame #26: 0x02b75668 GraphicsServices`GSEventRun + 104 frame #27: 0x00b57ffc UIKit`UIApplicationMain + 1211 frame #28: 0x00001fec RTEDemoApp`main(argc=1, argv=0xbffff208) + 92 at main.m:15 At first glance I assume that you would want to modify _adjustForAutomaticKeyboardInfo:animated:lastAdjustment: to check if the UITableViewController&#8217;s view is part of the view hierarchy of the inputView that triggered the inputView frame size change notification.]]></description>
				<content:encoded><![CDATA[<p>While working on the demo app for my DTRichTextEditor I stumbled across a bug that exists since iOS 6. You&#8217;ll notice that only if you set an inputView on an editable UIView and have it become first Responder.</p>
<p>Filed as rdar://13836932 and on <a href="http://www.openradar.me/13836932">OpenRadar</a>.</p>
<p>Update May 9th: Provided a Sample App, which is <a href="https://github.com/Cocoanetics/RadarSamples">also available on GitHub</a>.</p>
<p><span id="more-8141"></span></p>
<div id="more-8141"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Summary</h3>
<p>You can set a view as inputView for a editable view to appear in place of a keyboard. If this inputView has a scroll view this will erroneously receive a setContentInset after the keyboard finished its incoming animation.</p>
<h3>Steps to Reproduce</h3>
<ul>
<li>Create a UITableViewController</li>
<li>On a UIView that canBecomeFirstResponder set this VC&#8217;s view as inputView</li>
<li>have the UIView becomeFirstResponder</li>
</ul>
<h3>Expected Results</h3>
<ul>
<li>The UITableViewController&#8217;s tableView should not have a contentInset</li>
</ul>
<h3>Actual Results</h3>
<ul>
<li>Every UIScrollView receives a contentInset, even if it is itself the inputView that was showing &#8220;as keyboard&#8221;.</li>
</ul>
<h3>Regression</h3>
<ul>
<li>This automatic setting of contentInset started with iOS 6. It does not occur in iOS 5.</li>
</ul>
<h3>Notes</h3>
<p>I believe that the notification that gets sent after the keyboard/inputView animated in should take into consideration that scroll views that are subviews of the showing inputView don&#8217;t get a contentInset set.</p>
<p>As a workaround I am subclassing UITableView and overriding setContentInset: to ignore the erroneous setting.</p>
<p>This is the call stack I get on this overwritten contentInset:</p>
<pre>* thread #1: tid = 0x1c03, 0x0000f6ca RTEDemoApp`-[DTFormatTableView setContentInset:](self=0x099e5000, _cmd=0x09405f60, contentInset=(null)) + 58 at DTFormatTableView.m:16, stop reason = breakpoint 3.1
frame #0: 0x0000f6ca RTEDemoApp`-[DTFormatTableView setContentInset:](self=0x099e5000, _cmd=0x09405f60, contentInset=(null)) + 58 at DTFormatTableView.m:16
frame #1: 0x0373c1bd CoreFoundation`__invoking___ + 29
frame #2: 0x0373c0d6 CoreFoundation`-[NSInvocation invoke] + 342
frame #3: 0x016c7def Foundation`NSKVOForwardInvocation + 375
frame #4: 0x03737cf9 CoreFoundation`___forwarding___ + 905
frame #5: 0x0373794e CoreFoundation`_CF_forwarding_prep_0 + 14
frame #6: 0x00bc5029 UIKit`-[UIScrollView(UIScrollViewInternal) _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] + 377
frame #7: 0x00c14ddc UIKit`-[UITableView(UITableViewInternal) _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] + 73
frame #8: 0x00d87af9 UIKit`-[UITableViewController _adjustTableForKeyboardInfo:] + 201
frame #9: 0x00d86c27 UIKit`-[UITableViewControllerKeyboardSupport _keyboardDidChangeFrame:] + 131
frame #10: 0x016d44f9 Foundation`__57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 40
frame #11: 0x037a20c5 CoreFoundation`___CFXNotificationPost_block_invoke_0 + 85
frame #12: 0x036fcefa CoreFoundation`_CFXNotificationPost + 2122
frame #13: 0x01608bb2 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 98
frame #14: 0x00f08a29 UIKit`-[UIInputViewTransition postNotificationsForTransitionEnd] + 682
frame #15: 0x00f01e5c UIKit`__53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke_01079 + 203
frame #16: 0x00ba2df6 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 223
frame #17: 0x00b95d66 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 237
frame #18: 0x00b95f04 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 68
frame #19: 0x006a57d8 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 284
frame #20: 0x01ff0014 libdispatch.dylib`_dispatch_client_callout + 14
frame #21: 0x01fe07d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296
frame #22: 0x036eeaf5 CoreFoundation`__CFRunLoopRun + 1925
frame #23: 0x036edf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #24: 0x036ede1b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x02b757e3 GraphicsServices`GSEventRunModal + 88
frame #26: 0x02b75668 GraphicsServices`GSEventRun + 104
frame #27: 0x00b57ffc UIKit`UIApplicationMain + 1211
frame #28: 0x00001fec RTEDemoApp`main(argc=1, argv=0xbffff208) + 92 at main.m:15</pre>
<p>At first glance I assume that you would want to modify _adjustForAutomaticKeyboardInfo:animated:lastAdjustment: to check if the UITableViewController&#8217;s view is part of the view hierarchy of the inputView that triggered the inputView frame size change notification.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8141&amp;md5=769e0c607f89d53bf7dcf06dee19f535" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/radar-uiscrollview-should-not-adjust-content-inset-if-it-is-input-view/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fradar-uiscrollview-should-not-adjust-content-inset-if-it-is-input-view%2F&amp;language=en_GB&amp;category=text&amp;title=Radar%3A+UIScrollView+Should+Not+Adjust+Content+Inset+if+it+is+Input+View&amp;description=While+working+on+the+demo+app+for+my+DTRichTextEditor+I+stumbled+across+a+bug+that+exists+since+iOS+6.+You%26%238217%3Bll+notice+that+only+if+you+set+an+inputView+on+an...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Local CocoaPods</title>
		<link>http://www.cocoanetics.com/2013/05/8130/</link>
		<comments>http://www.cocoanetics.com/2013/05/8130/#comments</comments>
		<pubDate>Tue, 07 May 2013 07:49:17 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8130</guid>
		<description><![CDATA[Today I learned that besides of using CocoaPods pod specs via the official repo, you can also use local clones of the source code as pods. Up until now I was maintaining that one drawback of CocoaPods would be that it keeps a copy of all source files in the Pods subfolder of your project. If you made a change it would be hard to get the updates back into the upstream. Holger Singbaek taught me that you can also reference a local clone of a git repository holding a component. Consider the following Podfile: platform :ios, '5.0' pod 'DTCoreText', :path =&#62; '~/Documents/Projects/DTCoreText/', :branch =&#62; 'develop' Note: you need CocoaPods version 0.19 for that to work. Do a gem update cocoapods if you don&#8217;t have the current released version. If you have a project file in the same folder as the Podfile, this will set up a workspace to look like this: &#160; You can see that instead of the Pods group there is a new Local Pods group holding the local pod. Since DTCoreText references several DTFoundation sub-specs this is still present here in the traditional place. All file references in the Pods project reference the original files in the specified local clone. The M (for modified) you see here is from default.css being compiled during the pod installation into a c file so that it can be linked into the static library. With this setup you can go about developing your app and even use the latest (and hopefully greatest) version of the component. If you make any changes to the files you are editing the files in the local repository. Xcode should even be able to submit these commits to the correct repository from within the UI. Conclusion Local Pods allow you to integrate via pod local clones of components. Changes you make to the local files can then be submitted to the repo upstream with ease. Thank you Holger for pushing my knowledge forward in this matter. Thanks also go to to Fabio Pelosin who &#8211; being a contributor to the CocoaPods project &#8211; helped us find a workaround for a bug that exists in the post_install hook and showed us pre_install as an alternative. With this enhancement DTCoreText 1.5 is now working both as a remote as well as a local pod.]]></description>
				<content:encoded><![CDATA[<p>Today I learned that besides of using CocoaPods pod specs via the official repo, you can also use local clones of the source code as pods.</p>
<p><span id="more-8130"></span></p>
<div id="more-8130"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Up until now I was maintaining that one drawback of CocoaPods would be that it keeps a copy of all source files in the Pods subfolder of your project. If you made a change it would be hard to get the updates back into the upstream.</p>
<p>Holger Singbaek taught me that you can also reference a local clone of a git repository holding a component. Consider the following Podfile:</p>
<pre>platform :ios, '5.0'
pod 'DTCoreText', :path =&gt; '~/Documents/Projects/DTCoreText/', :branch =&gt; 'develop'</pre>
<p>Note: you need CocoaPods version 0.19 for that to work. Do a <strong>gem update cocoapods</strong> if you don&#8217;t have the current released version.</p>
<p>If you have a project file in the same folder as the Podfile, this will set up a workspace to look like this:</p>
<p><a href="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-07-at-09.32.30.png"><img class="alignnone size-full wp-image-8131" alt="Local Pods" src="http://i0.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-07-at-09.32.30.png?resize=361%2C268" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>You can see that instead of the <strong>Pods</strong> group there is a new <strong>Local Pods</strong> group holding the local pod. Since DTCoreText references several DTFoundation sub-specs this is still present here in the traditional place. All file references in the Pods project reference the original files in the specified local clone.</p>
<p>The M (for modified) you see here is from default.css being compiled during the pod installation into a c file so that it can be linked into the static library.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-07-at-09.35.47.png"><img class="alignnone size-full wp-image-8132" alt="Local Pod File Reference" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-07-at-09.35.47.png?resize=395%2C184" data-recalc-dims="1" /></a></p>
<p>With this setup you can go about developing your app and even use the latest (and hopefully greatest) version of the component. If you make any changes to the files you are editing the files in the local repository. Xcode should even be able to submit these commits to the correct repository from within the UI.</p>
<h3>Conclusion</h3>
<p>Local Pods allow you to integrate via pod local clones of components. Changes you make to the local files can then be submitted to the repo upstream with ease.</p>
<p>Thank you Holger for pushing my knowledge forward in this matter. Thanks also go to to Fabio Pelosin who &#8211; being a contributor to the CocoaPods project &#8211; helped us find a workaround for a bug that exists in the post_install hook and <a href="https://groups.google.com/forum/?fromgroups=#!topic/cocoapods/daw2c5zzmi8">showed us</a> pre_install as an alternative.</p>
<p>With this enhancement DTCoreText 1.5 is now working both as a remote as well as a local pod.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8130&amp;md5=0a2fa674494682815ddfe56b2f54e61f" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/8130/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2F8130%2F&amp;language=en_GB&amp;category=text&amp;title=Local+CocoaPods&amp;description=Today+I+learned+that+besides+of+using+CocoaPods+pod+specs+via+the+official+repo%2C+you+can+also+use+local+clones+of+the+source+code+as+pods.+Up+until+now+I...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Podcast #44 &#8211; &#8220;The Early Bird Catches the Worm&#8221;</title>
		<link>http://www.cocoanetics.com/2013/05/podcast-44-the-early-bird-catches-the-worm/</link>
		<comments>http://www.cocoanetics.com/2013/05/podcast-44-the-early-bird-catches-the-worm/#comments</comments>
		<pubDate>Mon, 06 May 2013 08:17:49 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Podcast]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8124</guid>
		<description><![CDATA[Toni Kaufmann and Oliver Drobnik chat about recent events, Toni shares some stories about where Microsoft has a leg up on Apple, and the history and future of WWDC. Show Notes Toni Kaufmann Company: http://www.n3xd.com Twitter: https://twitter.com/tonik173 Facebook (German): http://www.facebook.com/n3xd.de Facebook (English): http://www.facebook.com/n3xd.en YouTube: http://www.youtube.com/n3xdsoftwarestudios His Apps List of public apps from n3xd:  http://www.makingapps.de/who-is-who/programmieren/n3xd-software-studios-ag?filter=app Passwort: https://itunes.apple.com/ch/app/passwort-unique-passwords/id474416620 Passwort Algorithm: https://github.com/tonik173/Passwort-Encoder Alpineflower Finder: https://itunes.apple.com/ch/app/alpineflower-finder-discover/id576307211 Zoo Zürich: https://itunes.apple.com/ch/app/zoo-zurich/id527856894?l=en&#38;mt=8 Working on next big release 1.5 for DTRichTextEditor and DTCoreText. AutoIngest for Mac now with Sparkle. Refer to my WWDC ticketing flow chart to see the plethora of problems people had. Some statistics and musings on Women and WWDC. A new blog for Women and Tech. On the specifics of working with multiple people on Open Source projects. Using Kaleidoscope and SourceTree to diff and merge source code visually.]]></description>
				<content:encoded><![CDATA[<p><strong>Toni Kaufmann</strong> and <strong>Oliver Drobnik</strong> chat about recent events, Toni shares some stories about where Microsoft has a leg up on Apple, and the history and future of WWDC.</p>

<p><span id="more-8124"></span></p>
<div id="more-8124"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Show Notes</h3>
<p>Toni Kaufmann</p>
<div>
<ul>
<li><b>Company</b>: <a href="http://www.n3xd.com/">http://www.n3xd.com</a></li>
<li><strong>Twitter:</strong> <a href="https://twitter.com/tonik173">https://twitter.com/tonik173</a></li>
<li><b>Facebook</b> (German): <a href="http://www.facebook.com/n3xd.de">http://www.facebook.com/n3xd.de</a></li>
<li><b>Facebook</b> (English): <a href="http://www.facebook.com/n3xd.en">http://www.facebook.com/n3xd.en</a></li>
<li><b>YouTube</b>: <a href="http://www.youtube.com/n3xdsoftwarestudios">http://www.youtube.com/n3xdsoftwarestudios</a></li>
</ul>
</div>
<div>His Apps</div>
<div>
<ul>
<li><b>List of public apps from n3xd:</b>  <a href="http://www.makingapps.de/who-is-who/programmieren/n3xd-software-studios-ag?filter=app">http://www.makingapps.de/who-is-who/programmieren/n3xd-software-studios-ag?filter=app</a></li>
<li><b>Passwort</b>: <a href="https://itunes.apple.com/ch/app/passwort-unique-passwords/id474416620">https://itunes.apple.com/ch/app/passwort-unique-passwords/id474416620</a></li>
<li><b>Passwort Algorithm</b>: <a href="https://github.com/tonik173/Passwort-Encoder">https://github.com/tonik173/Passwort-Encoder</a></li>
<li><b>Alpineflower Finder</b>: <a href="https://itunes.apple.com/ch/app/alpineflower-finder-discover/id576307211">https://itunes.apple.com/ch/app/alpineflower-finder-discover/id576307211</a></li>
<li><b>Zoo Zürich: </b><a href="https://itunes.apple.com/ch/app/zoo-zurich/id527856894?l=en&amp;mt=8">https://itunes.apple.com/ch/app/zoo-zurich/id527856894?l=en&amp;mt=8</a></li>
</ul>
<p>Working on next big release 1.5 for DTRichTextEditor and <a href="https://github.com/Cocoanetics/DTCoreText/issues/429">DTCoreText</a>.</p>
<p><a title="AutoIngest for Mac 0.3.0" href="http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-3-0/">AutoIngest for Mac</a> now with Sparkle.</p>
<p>Refer to my <a title="WWDC Ticket Aftermath" href="http://www.cocoanetics.com/2013/04/wwdc-ticket-aftermath/">WWDC ticketing flow chart</a> to see the plethora of problems people had. Some statistics and musings on <a title="WWDC and Women" href="http://www.cocoanetics.com/2013/05/wwdc-and-women/">Women and WWDC</a>. A <a title="WWDC and Women" href="http://www.cocoanetics.com/2013/05/wwdc-and-women/">new blog for Women and Tech</a>.</p>
<p>On the specifics of working with multiple people on Open Source projects. Using <a href="http://www.kaleidoscopeapp.com">Kaleidoscope</a> and <a href="http://sourcetreeapp.com">SourceTree</a> to diff and merge source code visually.</p>
</div>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8124&amp;md5=7df9aaa94d9510f97cdf5e962b241227" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/podcast-44-the-early-bird-catches-the-worm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://www.cocoanetics.com/files/Cocoanetics_044.mp3" length="68869144" type="audio/mpeg" />
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fpodcast-44-the-early-bird-catches-the-worm%2F&amp;language=en_GB&amp;category=text&amp;title=Podcast+%2344+%26%238211%3B+%26%238220%3BThe+Early+Bird+Catches+the+Worm%26%238221%3B&amp;description=Toni+Kaufmann%C2%A0and%C2%A0Oliver+Drobnik%C2%A0chat+about+recent+events%2C+Toni+shares+some+stories+about+where+Microsoft+has+a+leg+up+on+Apple%2C+and+the+history+and+future+of+WWDC.+Show+Notes+Toni+Kaufmann...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>WWDC and Women</title>
		<link>http://www.cocoanetics.com/2013/05/wwdc-and-women/</link>
		<comments>http://www.cocoanetics.com/2013/05/wwdc-and-women/#comments</comments>
		<pubDate>Sun, 05 May 2013 10:03:41 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8106</guid>
		<description><![CDATA[When I attended my first WWDC in 2011 there was one gender-related observation I made which deeply troubled me: For the first time ever I had to queue in front of the male toilets. Up until this point I had been holding the belief that queues can only form in front of the female toilets. As with any belief your brain is filtering the world to find reasons and explanations. So my own working theory had been that this toilet queue conundrum must be  due to a male anatomical advantage, being able to &#8220;shoot from the hip&#8221;. Of course &#8211; given the same number of people &#8211; ladies would take longer, having to sit down, be more carefully washing their hands, powdering their noses and doing a bit of idle conversation. Men on the other hand would go pee like a SWAT team. In, Shoot the Fly, Out, done in 60 seconds. Washing our hands? Not necessary, we are engineers, we hit our targets. Not me, of course. I had never been aggressively domesticated by women to sit down for number 1. So I typically wash my hands because I don&#8217;t have the urge to prove to myself that my aim is flawless. Even though I like to believe it is. On this background I&#8217;m sure you understand my puzzlement. The second reason for it was that I never really worked in a male-dominated environment. Before I became an independent software engineer, I worked for some tech companies, but for the most part on my own, being the only Windows desktop support guy or being the only Telco Billing specialist on staff. Formative Years I have to admit that I was more of a lone wolf than a party animal. Not going out drinking also contributed to me staying out of male groups. The groups that you spend most of your time in while you are young must be contributing to your view of the world. My work places rarely shared Internet pictures of female car parking disasters. Male peers couldn&#8217;t infect me with misogyny, since I didn&#8217;t have anyone I could remotely consider to be my peer. If there was any &#8211; however brief &#8211; phase of female antipathy then only around the age of 20 when I was still a virgin, because I couldn&#8217;t &#8220;get any&#8221;. My hypotheses at that point in my life revolved around finding reasons why no woman seemed to be able to like or love me. That was also the time when those kind of &#8220;systems&#8221; started to pop up for &#8220;players&#8221; and how to &#8220;lay&#8221; any women. The core message being: you need to be arrogant and funny. If you treat women on a condescending manner then they would let you &#8220;bed&#8221; them. Doesn&#8217;t work yet? Well then you where not condescending enough! Admittedly I tried out a few tricks there and &#8220;scored some&#8221;. But I am not proud of that. Desperate, peer-less male engineers are the core audience for anybody promising a system for them to solve their loneliness problem. There is a whole industry catering to these suckers. Rise of the Internet While I was going to school to get my engineer&#8217;s degree we had a fair share of female would-be-developers attending, and I met a good number of women in most of the employments I had. So I never got a feeling that something must be wrong. I think my first actual contact with gender-related violence was somebody showing me an image he had gotten by email. Yes, at that time there were not websites for that kind of thing, let alone Twitter. It was a picture of a jumble of cars being parked totally chaotically. The subtitle read &#8220;Feminist Convention Parking&#8221;. It was not funny for me back then, but I found it curious that other men would find that laughter-inducing. Why are clichés funny? That was about the only kind of women disparagement I got in contact with. I was probably lucky enough in that matter, lonesome but untarnished. I grew up with the belief that women are equal to men in every aspect, accept that some might have dubious parallel parking skills. If anything then I was admiring women because I had heard that the male Y-chromosome was a mutation of the female X. While this mutation brought with it some advantages (like being able to pee standing up), apparently it also causes some problems. Bearers of the Y lack the full spectrum of emotion and communication. They live shorter. They cannot create life. I felt a little bit handicapped being a man, but learned to live with it. No point in being jealous of women, or being angry at them for having advantages over men. As the Internet grew larger and more prevalent communication and &#8220;social networking&#8221; [...]]]></description>
				<content:encoded><![CDATA[<p>When I attended my first <a title="WWDC 2011 Wrap-Up" href="http://www.cocoanetics.com/2011/06/wwdc-2011-wrap-up/">WWDC in 2011</a> there was one gender-related observation I made which deeply troubled me: For the first time ever I had to queue in front of the male toilets. Up until this point I had been holding the belief that queues can only form in front of the female toilets.</p>
<p>As with any belief your brain is filtering the world to find reasons and explanations. So my own working theory had been that this toilet queue conundrum must be  due to a male anatomical advantage, being able to &#8220;shoot from the hip&#8221;. Of course &#8211; given the same number of people &#8211; ladies would take longer, having to sit down, be more carefully washing their hands, powdering their noses and doing a bit of idle conversation. Men on the other hand would go pee like a SWAT team. In, Shoot the Fly, Out, done in 60 seconds. Washing our hands? Not necessary, we are engineers, we hit our targets.</p>
<p>Not me, of course. I had never been aggressively domesticated by women to sit down for number 1. So I typically wash my hands because I don&#8217;t have the urge to prove to myself that my aim is flawless. Even though I like to believe it is.</p>
<p><span id="more-8106"></span></p>
<div id="more-8106"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>On this background I&#8217;m sure you understand my puzzlement. The second reason for it was that I never really worked in a male-dominated environment. Before I became an independent software engineer, I worked for some tech companies, but for the most part on my own, being the only Windows desktop support guy or being the only Telco Billing specialist on staff.</p>
<h3>Formative Years</h3>
<p>I have to admit that I was more of a lone wolf than a party animal. Not going out drinking also contributed to me staying out of male groups. The groups that you spend most of your time in while you are young must be contributing to your view of the world.</p>
<p>My work places rarely shared Internet pictures of female car parking disasters. Male peers couldn&#8217;t infect me with misogyny, since I didn&#8217;t have anyone I could remotely consider to be my peer. If there was any &#8211; however brief &#8211; phase of female antipathy then only around the age of 20 when I was still a virgin, because I couldn&#8217;t &#8220;get any&#8221;. My hypotheses at that point in my life revolved around finding reasons why no woman seemed to be able to like or love me.</p>
<p>That was also the time when those kind of &#8220;systems&#8221; started to pop up for &#8220;players&#8221; and how to &#8220;lay&#8221; any women. The core message being: you need to be arrogant and funny. If you treat women on a condescending manner then they would let you &#8220;bed&#8221; them. Doesn&#8217;t work yet? Well then you where not condescending enough!</p>
<p>Admittedly I tried out a few tricks there and &#8220;scored some&#8221;. But I am not proud of that. Desperate, peer-less male engineers are the core audience for anybody promising a system for them to solve their loneliness problem. There is a whole industry catering to these suckers.</p>
<h3>Rise of the Internet</h3>
<p><img class=" wp-image-8111 alignright" style="margin-left: 10px; margin-bottom: 10px;" alt="Men at Work" src="http://i2.wp.com/www.cocoanetics.com/files/shutterstock_12151666.jpg?resize=302%2C450" data-recalc-dims="1" /></p>
<p>While I was going to school to get my engineer&#8217;s degree we had a fair share of female would-be-developers attending, and I met a good number of women in most of the employments I had. So I never got a feeling that something must be wrong. I think my first actual contact with gender-related violence was somebody showing me an image he had gotten by email. Yes, at that time there were not websites for that kind of thing, let alone Twitter.</p>
<p>It was a picture of a jumble of cars being parked totally chaotically. The subtitle read &#8220;Feminist Convention Parking&#8221;. It was not funny for me back then, but I found it curious that other men would find that laughter-inducing. Why are clichés funny?</p>
<p>That was about the only kind of women disparagement I got in contact with. I was probably lucky enough in that matter, lonesome but untarnished. I grew up with the belief that women are equal to men in every aspect, accept that some might have dubious parallel parking skills.</p>
<p>If anything then I was admiring women because I had heard that the male Y-chromosome was a mutation of the female X. While this mutation brought with it some advantages (like being able to pee standing up), apparently it also causes some problems. Bearers of the Y lack the full spectrum of emotion and communication. They live shorter. They cannot create life. I felt a little bit handicapped being a man, but learned to live with it.</p>
<p>No point in being jealous of women, or being angry at them for having advantages over men.</p>
<p>As the Internet grew larger and more prevalent communication and &#8220;social networking&#8221; exploded. When this happens information hierarchies &#8211; with a single entity disseminating information to all below it &#8211; tumble. Instead you have the information flow more akin to a network where some nodes are better connected then others, but in the end all nodes of the network get the information.</p>
<p>This also means that nowadays the light is shone on every tiny infraction. Anything good or bad is blogged about, dissected and opined ad nauseam. Misogynist are outed in a heart beat. This social network &#8211; which many call Web 2.0 &#8211; has become enough of a power to influence elections and to destroy companies that misstep.</p>
<h3>Programmer-ettes</h3>
<p>When I visited San Francisco in 2011 I learned that it seems to be hard for companies to hire iOS developers. Especially on iOS you were able to build an app, have Apple sell it for you and then call yourself &#8220;indie&#8221;. And the ones that didn&#8217;t want to be self-employed where gobbled up by companies like Apple. No available developers were to be found.</p>
<p>There are companies like Etsy who had the same problem with too few developers. The theory goes that if you want more developers on the market you need to &#8220;activate&#8221; the female population. If you had the same number of female developers as you had male then you would have double the number of candidates to hire.</p>
<p>Etsy managed to grow the number of female engineers by 500% (<a href="http://www.youtube.com/watch?v=w4LExVkv4Pw">video</a>) by establishing a summer scholarship program. They invited young women to San Francisco, paid for living expenses and contracted a company to do programming courses on location in the Etsy offices. The lion share of attendees of this program opted to stay at Etsy, with a much larger than usual portion of women.</p>
<p>I have yet to see any other strategy that even comes close to their rate of success.</p>
<p>One often cited reason for the lack of female developers is that they probably didn&#8217;t get enough encouragement as teenagers. I often hear people argument that if women wanted to they would be totally equal with men. There are no barriers to them being that any more. Those people fail to see that they themselves are part of the problem.</p>
<p>A lack of barriers does not equate to forward momentum. Men who think that there is no problem anyway won&#8217;t act. Why bother if your world is ok?</p>
<h3>WWDC Statistics</h3>
<p>For the third time in a row I am scouring Tweets for information on who got a WWDC ticket and who activated it. The people I find I put on my <a href="https://twitter.com/cocoanetics/WWDC2013Attendees">WWDC 2013 Attendees Twitter list</a>. At the time of this writing I have collected 324 list members, of which 5 are women. That is 1.5%. In my experience less then 10% of Apple developers use Twitter, but nevertheless I see no reason why there would be a gender difference in tweeting. I think my number should be in the general vicinity of the actual number.</p>
<p>Somebody asked an Apple employee at WWDC 2012 and got the, albeit inofficial, information of 3.5% female attendance. The <a href="https://twitter.com/wwdcgirls">WWDC Girls</a> Twitter account follows 216 women who stated that they attend WWDC. That would be about 4% of 5500 tickets.</p>
<p>Only Apple knows the real number but these data points suggest that the number of female WWDC attendees must be in the low single digit range. 3.5% sounds quite plausible to me.</p>
<p>Apple&#8217;s credo is &#8220;to treat everybody the same&#8221;, regardless of his/her parameters. But personally I fear that WWDC has turned into an unwilling act of gender inequality. There has been much discussion about if and how Apple should change WWDC to be &#8220;more fair&#8221;. I believe that this overlooks a larger issue related to gender discrimination.</p>
<p>I would venture a bet that most of the people able to afford travel, accommodation and entry to WWDC can do so because a company is footing the bill. There is some commercial interest in these people learning about the latest and greatest Apple technologies. Put differently I am sending somebody to a conference that costs me around $4000 per person if I believe that this person is able to add at least as much value over the coming year to my business.</p>
<p>But since last year getting tickets has turned into a crap shoot.</p>
<p>My fear is that companies are securing a ticket for their lead developers and development managers first to be certain that they can attend, because them getting the infos would be way more valuable than if they sent lower level engineers. A dev lead can spend more quality time with Apple engineers and talk to the app store review team on behalf of the company&#8217;s interests.</p>
<p>Because of this we probably will get even fewer female attendees. Of the few female engineers even fewer would be holding a sufficiently high up position to be sent to WWDC.</p>
<p><img class="alignnone size-full wp-image-8110" alt="Women and Tablet" src="http://i1.wp.com/www.cocoanetics.com/files/shutterstock_135164513.jpg?resize=500%2C332" data-recalc-dims="1" /></p>
<h3>WWDC Scholarship for Women</h3>
<p>Apple is literally giving away 150 tickets out of the 5500 to students. They have been doing that for many years now since it is in Apple&#8217;s best interest to get on a good footing with people while they are at school. In exchange for such a ticket students need to create and present an app that tells Apple something about themselves.</p>
<p>One could argue that this program is unfair to the rest of us hard working software developers. I need to scrape together about a month&#8217;s worth of earnings to be able to afford to travel to WWDC. And I think that I have done more for Apple &#8216;s business in my 4 full time years, than most of these students will do in their lifetime.</p>
<p>Even calling it a &#8220;Student Scholarship&#8221; is a misnomer. A true scholarship does not only pay for a ticket for an event but also takes other burdens off the student&#8217;s shoulders. What Etsy did is a true scholarship. What Apple does is just giving away free event tickets based in part on merit.</p>
<p>This is why I propose for Apple to adapt their &#8220;Scholarship&#8221; program to a be a true scholarship program. They would pay for living expenses and training for a larger group based on merit. And not just leading up to WWDC but throughout the year. Of course nowadays you have to do such a problem gender-neutrally, but Etsy&#8217;s experience has shown that you tend to get equal numbers of both sexes in such scholarship programs.</p>
<p>Apple then would be able to get first pick of the engineers coming out of the program and also they could give the student tickets to participants of their new scholarship program. The development public would see this as much &#8220;fairer&#8221; because you would have to learn programming for several months instead of being awarded a lucky break based on a simple quick app you whip up.</p>
<h3>F&#8217;in BSc</h3>
<p>The main hinderance that US-based companies have related to hiring developers is that they require their on candidates to have a Bachelor of Computer Science (BSc). If you don&#8217;t have an academic degree most companies wouldn&#8217;t even talk to you, regardless of your other qualifications. I couldn&#8217;t work for Apple even if I wanted to, because I don&#8217;t possess a BSc nor any other academic degree. Instead I have an engineers diploma which i got from the Austrian government after a 2-year school and 3 years of working. My &#8220;engineer&#8217;s degree&#8221; is civil and not academic.</p>
<p>So I could bring much to Apple, but they wouldn&#8217;t ever consider me because of my lack of BSc. Also I would probably not even get a US work visa since for these you also need a BSc. The US work visa situation is a horror story in its own right.</p>
<p>This reliance on academic degrees is especially pronounced in the US of A. Programming was an academic endeavor 30 years ago, but in times of the Internet everybody can learn to program, and program well. If I need a certain algorithm I can look it up on Wikipedia or maybe find it explained on Stack Overflow or better yet find it already implemented in Open Source software.</p>
<p>To participate in Apple&#8217;s above mentioned &#8220;Student Scholarship&#8221; you need to be enrolled as a student for a BSc degree.</p>
<p>Reliance on academic diplomas or a specific age range or school attendance is a form of discrimination of it&#8217;s own. I have no numbers, but it is my feeling that this BSc-addiction also blinds companies to many amazing female prospects who didn&#8217;t have the necessary funding to go to college.</p>
<p>Some people see this a left-over from a patriarchal age where male managers where judging people&#8217;s worthiness based on their academic degrees.</p>
<h3>Conclusion</h3>
<p>There are too few women attending WWDC, period. This is a symptom of a large problem that needs to be addressed im my humble opinion by removing the outmoded reliance on academic achievements and by sponsoring young people who are interested in learning to program.</p>
<p>A true scholarship program needs to go over several months, unburden students from living expenses and include real work and learning. Companies like Etsy have shown that such a program will get an even number of males and females with the final result of ending up with an overall greater number of developers, of which females form a much higher than usual percentage.</p>
<p>Apple should be a shining example and &#8220;sherlock&#8221; the scholarship idea. In the least they should stop calling a scholarship which is none. Making apps has ceased to be a science a couple of years ago, it became vocational. Companies who still think that they need academics for programmers are only hurting themselves.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8106&amp;md5=0b024caef948a6c63d54d39dfff4a01b" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/wwdc-and-women/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fwwdc-and-women%2F&amp;language=en_GB&amp;category=text&amp;title=WWDC+and+Women&amp;description=When+I+attended+my+first+WWDC+in+2011%C2%A0there+was+one+gender-related+observation+I+made+which+deeply+troubled+me%3A+For+the+first+time+ever+I+had+to+queue+in+front+of...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>AutoIngest for Mac 0.3.0</title>
		<link>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-3-0/</link>
		<comments>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-3-0/#comments</comments>
		<pubDate>Fri, 03 May 2013 17:41:00 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[AutoIngest]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8100</guid>
		<description><![CDATA[This new version of the Mac status bar app for automatically downloading sales reports contains a few minor fixes: Changes Replaced Status Bar Icon with vector-based version Improved Menu Handling Code Improved handling of Mac Standby Reduced Min OS Version to 10.7 Added Validation for Vendor ID Added Automatic Updates via Sparkle The Developer-ID signed version with Sparkle can be downloaded here, and of course you can build a version yourself from the 0.3.0 tag on GitHub.]]></description>
				<content:encoded><![CDATA[<p>This new version of the Mac status bar app for automatically downloading sales reports contains a few minor fixes:</p>
<h3>Changes</h3>
<ul>
<li>Replaced Status Bar Icon with vector-based version</li>
<li>Improved Menu Handling Code</li>
<li>Improved handling of Mac Standby</li>
<li>Reduced Min OS Version to 10.7</li>
<li>Added Validation for Vendor ID</li>
<li>Added Automatic Updates via Sparkle</li>
</ul>
<p>The Developer-ID signed version with Sparkle can be <a href="http://beta.cocoanetics.com/Cocoanetics/com.cocoanetics.AutoIngest/43/AutoIngest.zip">downloaded here</a>, and of course you can build a version yourself from the 0.3.0 tag <a href="https://github.com/cocoanetics/autoingest">on GitHub</a>.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8100&amp;md5=85c9964f57990bec0b675a4fca3dd30f" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/autoingest-for-mac-0-3-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fautoingest-for-mac-0-3-0%2F&amp;language=en_GB&amp;category=text&amp;title=AutoIngest+for+Mac+0.3.0&amp;description=This+new+version+of+the+Mac+status+bar+app+for+automatically+downloading+sales+reports+contains+a+few+minor+fixes%3A+Changes+Replaced+Status+Bar+Icon+with+vector-based+version+Improved+Menu+Handling...&amp;tags=AutoIngest%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Urban Airship Commander 1.1.2</title>
		<link>http://www.cocoanetics.com/2013/05/urban-airship-commander-1-1-2/</link>
		<comments>http://www.cocoanetics.com/2013/05/urban-airship-commander-1-1-2/#comments</comments>
		<pubDate>Thu, 02 May 2013 15:21:09 +0000</pubDate>
		<dc:creator>gugmaster</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[Airship Commander]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8097</guid>
		<description><![CDATA[This is a bugfix release for Urban Airship Commander, our app for easily sending push notifications via Urban Airship. Changes FIXED: When Copy to new Message in Log was chosen the custom fields were not used in some cases. The update has been submitted to Apple for review. Update May 7th: Approved after 4 days.]]></description>
				<content:encoded><![CDATA[<p>This is a bugfix release for <a href="http://www.cocoanetics.com/apps/airship-commander/" target="_blank">Urban Airship Commander</a>, our app for easily sending push notifications via Urban Airship.</p>
<h3>Changes</h3>
<ul>
<li>FIXED: When Copy to new Message in Log was chosen the custom fields were not used in some cases.</li>
</ul>
<p>The update has been submitted to Apple for review.</p>
<p>Update May 7th: Approved after 4 days.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8097&amp;md5=08f0b1b8c419fdef2fdc0a467022a0e1" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/urban-airship-commander-1-1-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Furban-airship-commander-1-1-2%2F&amp;language=en_GB&amp;category=text&amp;title=Urban+Airship+Commander+1.1.2&amp;description=This+is+a+bugfix+release+for+Urban+Airship+Commander%2C+our+app+for+easily+sending+push+notifications+via+Urban+Airship.+Changes+FIXED%3A+When+Copy+to+new+Message+in+Log+was+chosen...&amp;tags=Airship+Commander%2Cblog" type="text/html" />
	</item>
		<item>
		<title>New Blog for Tech Ladies</title>
		<link>http://www.cocoanetics.com/2013/05/new-blog-for-tech-ladies/</link>
		<comments>http://www.cocoanetics.com/2013/05/new-blog-for-tech-ladies/#comments</comments>
		<pubDate>Wed, 01 May 2013 19:26:11 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Publishing]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8090</guid>
		<description><![CDATA[I&#8217;ve been sponsoring my cousin Julia Grill for a while now. She&#8217;s a teenager that has a strong interest in technology, but never gotten much support for her wish to pursue a career in this field. So I made it my mission to help her out in these matters. Today Julia launches her new blog which is targeted at other young tech-curious women, and she&#8217;s calling it TechCriquette. You can read about the meaning of this unusual name and what her mission statement is on her first blog post. You are welcome to give her hints about companies or products that do an exceptionally good or bad job in talking to women. Options on how to contact her can be found on the TechCriquette About page.]]></description>
				<content:encoded><![CDATA[<p><a href="http://i2.wp.com/www.cocoanetics.com/files/295422_494052207316172_699893094_a.png"><img class="size-full wp-image-8092 alignright" alt="TechCriquette Logo" src="http://i2.wp.com/www.cocoanetics.com/files/295422_494052207316172_699893094_a.png?resize=121%2C121" data-recalc-dims="1" /></a>I&#8217;ve been sponsoring my cousin Julia Grill for a while now. She&#8217;s a teenager that has a strong interest in technology, but never gotten much support for her wish to pursue a career in this field. So I made it my mission to help her out in these matters.</p>
<p>Today <strong>Julia launches her new blog</strong> which is targeted at other young tech-curious women, and she&#8217;s calling it <a href="http://www.techcriquette.net">TechCriquette</a>. You can read about the meaning of this unusual name and what her mission statement is on her <a href="http://www.techcriquette.net/2013/04/05/introducing-techcriquette/">first blog post</a>.</p>
<p>You are welcome to give her hints about companies or products that do an exceptionally good or bad job in talking to women. Options on how to contact her can be found on the <a href="http://www.techcriquette.net/about/">TechCriquette About page</a>.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8090&amp;md5=a93b2dd5ca0377a90a0f434bd1b3dbd5" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/new-blog-for-tech-ladies/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fnew-blog-for-tech-ladies%2F&amp;language=en_GB&amp;category=text&amp;title=New+Blog+for+Tech+Ladies&amp;description=I%26%238217%3Bve+been+sponsoring+my+cousin+Julia+Grill+for+a+while+now.+She%26%238217%3Bs+a+teenager+that+has+a+strong+interest+in+technology%2C+but+never+gotten+much+support+for+her+wish+to...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Getting Glyph Paths with DTCoreText</title>
		<link>http://www.cocoanetics.com/2013/05/getting-glyph-paths-with-dtcoretext/</link>
		<comments>http://www.cocoanetics.com/2013/05/getting-glyph-paths-with-dtcoretext/#comments</comments>
		<pubDate>Wed, 01 May 2013 12:34:00 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8081</guid>
		<description><![CDATA[A client wanted to have a method for producing text that has a &#8220;cut out&#8221; effect, aka Text with &#8220;Inner Shadow&#8221;. Sort of like if you take a sheet of paper and then cut out the letters, then have light coming from up and slightly to the left so that it throws a shadow into the cut out letters. For such a scenario you have to get a CGPath that is comprised of the glyphs that make up the text. Those are called glyphs because in some languages they are letters, but in some others they are not. Glyphs are the atomic element that any written language consists of. Because it reasonably fits with the other work I have already done in DTCoreText I added such a method to both the classes for glyph runs as well as lines. These new methods will be released in the upcoming DTCoreText 1.5 release. Many thanks go to Zach Waldowski whose method of constructing the glyph and line paths in AZAppearanceKit I used as a starting point. Zach has quite a few smart block-based enumerators for CTRuns and what not. But since I have a distinct class to represent a glyph run &#8211; called DTCoreTextGlyphRun &#8211; I opted to instead put the method to construct the glyph path in there. There are some other decisions that I had to do differently. For example I am supporting synthetic italics for fonts that don&#8217;t have an italic typeface. This is done by supplying a transformation matrix when creating the font. Zach was ignoring this matrix and used it instead to position the individual glyphs. Nevertheless I would have had to do much lengthier research without Zach. This is the final result which I will now proceed to demonstrate how to achieve. Note that this is as simple an approach as was justified to show the basic concepts. I challenge the reader to experiment with Quartz to get an even nicer looking shadow effect. The steps to produce this effect are: Create a DTCoreTextLayoutFrame for your text For drawing, iterate over all DTCoreTextLayoutLine elements in the layout frame Retrieve the path for all glyphs in the line Do your fancy drawing to a view or bitmap context To keep this example as easy as possible, let&#8217;s create a method that creates a bitmap with some arbitrary text. For the sake of this demonstration I am using the latest develop branch version of DTCoreText and I&#8217;m putting all the demo code into the CoreTextDemoAppDelegate. For the first step I&#8217;m creating an attributed string via HTML, create an image via a new method and then just &#8211; brutally &#8211; slap it into an image view and add it to the main window, just to see what&#8217;s going on. - &#40;void&#41;_demo &#123; // create attributed text NSString *html = @&#34;&#60;div style=\&#34;font-family:Helvetica;font-size:60px\&#34;&#62;&#60;b&#62;Testing&#60;/b&#62;&#60;/div&#62;&#34;; NSData *data = &#91;html dataUsingEncoding:NSUTF8StringEncoding&#93;; NSAttributedString *text = &#91;&#91;NSAttributedString alloc&#93; initWithHTMLData:data documentAttributes:NULL&#93;; &#160; // create image with inner shadow from it UIImage *image = &#91;self imageWithInnerShadowForText:text&#93;; &#160; // to show it, just put it into an image view UIImageView *imageView = &#91;&#91;UIImageView alloc&#93; initWithImage:image&#93;; imageView.layer.borderWidth = 1; imageView.layer.borderColor = &#91;UIColor redColor&#93;.CGColor; &#160; &#91;_window addSubview:imageView&#93;; &#125; The imageWithInnerShadowForText does the rest. Read the inline comments to learn what is happening here. - &#40;UIImage *&#41;imageWithInnerShadowForText:&#40;NSAttributedString *&#41;text &#123; // create a layouter, this owns the attributed string DTCoreTextLayouter *layouter = &#91;&#91;DTCoreTextLayouter alloc&#93; initWithAttributedString:text&#93;; &#160; // create a wide enough frame with open height NSRange fullRange = NSMakeRange&#40;0, &#91;text length&#93;&#41;; CGRect rect = CGRectMake&#40;10, 10, 10000, CGFLOAT_OPEN_HEIGHT&#41;; // height unknown DTCoreTextLayoutFrame *layoutFrame = &#91;layouter layoutFrameWithRect:rect range:fullRange&#93;; &#160; // get actually used space CGRect rectCovered = layoutFrame.intrinsicContentFrame; CGRect bounds = CGRectMake&#40;0, 10, rectCovered.size.width, rectCovered.size.height+10&#41;; &#160; UIGraphicsBeginImageContextWithOptions&#40;bounds.size, YES, 0&#41;; CGContextRef context = UIGraphicsGetCurrentContext&#40;&#41;; &#160; // background CGContextSetGrayFillColor&#40;context, 1, 1&#41;; CGContextFillRect&#40;context, bounds&#41;; &#160; for &#40;DTCoreTextLayoutLine *line in layoutFrame.lines&#41; &#123; CGContextSaveGState&#40;context&#41;; &#160; // get the glyph path CGPathRef linePath = &#91;line newPathWithGlyphs&#93;; &#160; // clip to that CGContextAddPath&#40;context, linePath&#41;; CGContextClip&#40;context&#41;; &#160; // draw &#34;lower level slightly darker&#34; CGContextSetGrayFillColor&#40;context, 0.95, 1&#41;; CGContextFillRect&#40;context, bounds&#41;; &#160; // add the path for shadow CGContextAddPath&#40;context, linePath&#41;; &#160; UIColor *shadowColor = &#91;UIColor blackColor&#93;; CGContextSetShadowWithColor&#40;context, CGSizeMake&#40;0.5, 2&#41;, 2, shadowColor.CGColor&#41;; CGContextSetLineWidth&#40;context, 1&#41;; CGContextStrokePath&#40;context&#41;; &#160; // remove clipping CGContextRestoreGState&#40;context&#41;; &#160; // draw the outline a bit thicker to remove it CGContextAddPath&#40;context, linePath&#41;; CGContextSetLineWidth&#40;context, 2&#41;; CGContextSetGrayStrokeColor&#40;context, 1, 1&#41;; CGContextDrawPath&#40;context, kCGPathStroke&#41;; &#125; &#160; UIImage *image = UIGraphicsGetImageFromCurrentImageContext&#40;&#41;; UIGraphicsEndImageContext&#40;&#41;; &#160; return image; &#125; The result that this will produce looks like the following picture. I took the liberty of drawing the outline a bit thicker a second time after having removed the glyph clipping. The 10s you see in the code are for moving the text 10 pixels away from the edges of the drawing context. How do you like it? I also made the shading inside the characters a slightly bit darker. The combination of all these parameters gives [...]]]></description>
				<content:encoded><![CDATA[<p>A client wanted to have a method for producing text that has a &#8220;cut out&#8221; effect, aka Text with &#8220;Inner Shadow&#8221;. Sort of like if you take a sheet of paper and then cut out the letters, then have light coming from up and slightly to the left so that it throws a shadow into the cut out letters.</p>
<p>For such a scenario you have to get a CGPath that is comprised of the glyphs that make up the text. Those are called glyphs because in some languages they are letters, but in some others they are not. Glyphs are the atomic element that any written language consists of.</p>
<p>Because it reasonably fits with the other work I have already done in DTCoreText I added such a method to both the classes for glyph runs as well as lines. These new methods will be released in the upcoming DTCoreText 1.5 release.</p>
<p><span id="more-8081"></span></p>
<div id="more-8081"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Many thanks go to Zach Waldowski whose method of constructing the glyph and line paths in <a href="https://github.com/zwaldowski/AZAppearanceKit">AZAppearanceKit</a> I used as a starting point. Zach has quite a few smart block-based enumerators for CTRuns and what not. But since I have a distinct class to represent a glyph run &#8211; called DTCoreTextGlyphRun &#8211; I opted to instead put the method to construct the glyph path in there.</p>
<p>There are some other decisions that I had to do differently. For example I am supporting synthetic italics for fonts that don&#8217;t have an italic typeface. This is done by supplying a transformation matrix when creating the font. Zach was ignoring this matrix and used it instead to position the individual glyphs. Nevertheless I would have had to do much lengthier research without Zach.</p>
<p>This is the final result which I will now proceed to demonstrate how to achieve. Note that this is as simple an approach as was justified to show the basic concepts. I challenge the reader to experiment with Quartz to get an even nicer looking shadow effect.</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-01-at-1.12.31-PM.png"><img class="alignnone size-full wp-image-8083" alt="Text with inner shadow" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-01-at-1.12.31-PM.png?resize=509%2C162" data-recalc-dims="1" /></a></p>
<p>The steps to produce this effect are:</p>
<ol>
<li><span style="line-height: 13px;">Create a DTCoreTextLayoutFrame for your text</span></li>
<li>For drawing, iterate over all DTCoreTextLayoutLine elements in the layout frame</li>
<li>Retrieve the path for all glyphs in the line</li>
<li>Do your fancy drawing to a view or bitmap context</li>
</ol>
<p>To keep this example as easy as possible, let&#8217;s create a method that creates a bitmap with some arbitrary text.</p>
<p>For the sake of this demonstration I am using the latest develop branch version of DTCoreText and I&#8217;m putting all the demo code into the CoreTextDemoAppDelegate.</p>
<p>For the first step I&#8217;m creating an attributed string via HTML, create an image via a new method and then just &#8211; brutally &#8211; slap it into an image view and add it to the main window, just to see what&#8217;s going on.</p>

<div class="wp_codebox"><table><tr id="p808154"><td class="code" id="p8081code54"><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>_demo
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// create attributed text</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>html <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;div style=<span style="color: #2400d9;">\&quot;</span>font-family:Helvetica;font-size:60px<span style="color: #2400d9;">\&quot;</span>&gt;&lt;b&gt;Testing&lt;/b&gt;&lt;/div&gt;&quot;</span>;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/"><span style="color: #400080;">NSData</span></a> <span style="color: #002200;">*</span>data <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>html dataUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/"><span style="color: #400080;">NSAttributedString</span></a> <span style="color: #002200;">*</span>text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/"><span style="color: #400080;">NSAttributedString</span></a> alloc<span style="color: #002200;">&#93;</span> initWithHTMLData<span style="color: #002200;">:</span>data documentAttributes<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// create image with inner shadow from it</span>
	UIImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self imageWithInnerShadowForText<span style="color: #002200;">:</span>text<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// to show it, just put it into an image view</span>
	UIImageView <span style="color: #002200;">*</span>imageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span>image<span style="color: #002200;">&#93;</span>;
	imageView.layer.borderWidth <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
	imageView.layer.borderColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor redColor<span style="color: #002200;">&#93;</span>.CGColor;
&nbsp;
	<span style="color: #002200;">&#91;</span>_window addSubview<span style="color: #002200;">:</span>imageView<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>The imageWithInnerShadowForText does the rest. Read the inline comments to learn what is happening here.</p>

<div class="wp_codebox"><table><tr id="p808155"><td class="code" id="p8081code55"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>imageWithInnerShadowForText<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/"><span style="color: #400080;">NSAttributedString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>text
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// create a layouter, this owns the attributed string</span>
	DTCoreTextLayouter <span style="color: #002200;">*</span>layouter <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DTCoreTextLayouter alloc<span style="color: #002200;">&#93;</span> initWithAttributedString<span style="color: #002200;">:</span>text<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// create a wide enough frame with open height</span>
	<span style="color: #a61390;">NSRange</span> fullRange <span style="color: #002200;">=</span> NSMakeRange<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #002200;">&#91;</span>text length<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
	CGRect rect <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">10</span>, <span style="color: #2400d9;">10</span>, <span style="color: #2400d9;">10000</span>, CGFLOAT_OPEN_HEIGHT<span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">// height unknown</span>
	DTCoreTextLayoutFrame <span style="color: #002200;">*</span>layoutFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>layouter layoutFrameWithRect<span style="color: #002200;">:</span>rect range<span style="color: #002200;">:</span>fullRange<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// get actually used space</span>
	CGRect rectCovered <span style="color: #002200;">=</span> layoutFrame.intrinsicContentFrame;
	CGRect bounds <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">10</span>, rectCovered.size.width, rectCovered.size.height<span style="color: #002200;">+</span><span style="color: #2400d9;">10</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	UIGraphicsBeginImageContextWithOptions<span style="color: #002200;">&#40;</span>bounds.size, <span style="color: #a61390;">YES</span>, <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
	CGContextRef context <span style="color: #002200;">=</span> UIGraphicsGetCurrentContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// background</span>
	CGContextSetGrayFillColor<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">1</span>, <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
	CGContextFillRect<span style="color: #002200;">&#40;</span>context, bounds<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span>DTCoreTextLayoutLine <span style="color: #002200;">*</span>line <span style="color: #a61390;">in</span> layoutFrame.lines<span style="color: #002200;">&#41;</span>
	<span style="color: #002200;">&#123;</span>
		CGContextSaveGState<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// get the glyph path</span>
		CGPathRef linePath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>line newPathWithGlyphs<span style="color: #002200;">&#93;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// clip to that</span>
		CGContextAddPath<span style="color: #002200;">&#40;</span>context, linePath<span style="color: #002200;">&#41;</span>;
		CGContextClip<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// draw &quot;lower level slightly darker&quot;</span>
		CGContextSetGrayFillColor<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">0.95</span>, <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
		CGContextFillRect<span style="color: #002200;">&#40;</span>context, bounds<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// add the path for shadow</span>
		CGContextAddPath<span style="color: #002200;">&#40;</span>context, linePath<span style="color: #002200;">&#41;</span>;
&nbsp;
		UIColor <span style="color: #002200;">*</span>shadowColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor blackColor<span style="color: #002200;">&#93;</span>;
		CGContextSetShadowWithColor<span style="color: #002200;">&#40;</span>context, CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.5</span>, <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span>, <span style="color: #2400d9;">2</span>, shadowColor.CGColor<span style="color: #002200;">&#41;</span>;
		CGContextSetLineWidth<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
		CGContextStrokePath<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// remove clipping</span>
		CGContextRestoreGState<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
&nbsp;
		<span style="color: #11740a; font-style: italic;">// draw the outline a bit thicker to remove it</span>
		CGContextAddPath<span style="color: #002200;">&#40;</span>context, linePath<span style="color: #002200;">&#41;</span>;
		CGContextSetLineWidth<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span>;
		CGContextSetGrayStrokeColor<span style="color: #002200;">&#40;</span>context, <span style="color: #2400d9;">1</span>, <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span>;
		CGContextDrawPath<span style="color: #002200;">&#40;</span>context, kCGPathStroke<span style="color: #002200;">&#41;</span>;
	<span style="color: #002200;">&#125;</span>
&nbsp;
	UIImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> UIGraphicsGetImageFromCurrentImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
	UIGraphicsEndImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> image;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>The result that this will produce looks like the following picture. I took the liberty of drawing the outline a bit thicker a second time after having removed the glyph clipping. The 10s you see in the code are for moving the text 10 pixels away from the edges of the drawing context.</p>
<p>How do you like it?</p>
<p><a href="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-01-at-2.21.43-PM.png"><img class="alignnone size-full wp-image-8085" alt="Demo Result" src="http://i1.wp.com/www.cocoanetics.com/files/Screen-Shot-2013-05-01-at-2.21.43-PM.png?resize=638%2C319" data-recalc-dims="1" /></a></p>
<p>I also made the shading inside the characters a slightly bit darker. The combination of all these parameters gives it a nice three-dimensional effect.</p>
<h3>Conclusion</h3>
<p>With the new methods for retrieving glyph paths in DTCoreText 1.5 you can let your creativity run wild with what you want to do with the shapes of these characters. The method to produce an &#8220;Inner Shadow&#8221; effect is just a starting point, you should experiment with the parameters to get the effect that you are looking for.</p>
<p>A word of caution: when drawing text CoreText does some nifty sub-pixel-smoothing. This effect is not possible when rendering into bitmap contexts because don&#8217;t have any sub-pixels. Instead Quartz antialiases edges by making them slightly blurry. It is not easy to find a sweet spot where the outlines of this custom drawn text remain visibly sharp but you still get a nice effect.</p>
<p>If you have any tips for us as to how to improve the visual fidelity further, please let us know in the comments.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8081&amp;md5=55f52dc0b2a9660b1f945a34d2d9e9b4" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/05/getting-glyph-paths-with-dtcoretext/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F05%2Fgetting-glyph-paths-with-dtcoretext%2F&amp;language=en_GB&amp;category=text&amp;title=Getting+Glyph+Paths+with+DTCoreText&amp;description=A+client+wanted+to+have+a+method+for+producing+text+that+has+a+%26%238220%3Bcut+out%26%238221%3B+effect%2C+aka+Text+with+%26%238220%3BInner+Shadow%26%238221%3B.+Sort+of+like+if+you+take+a+sheet+of...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Radar: App gets killed without Crash Log</title>
		<link>http://www.cocoanetics.com/2013/04/radar-app-gets-killed-without-crash-log/</link>
		<comments>http://www.cocoanetics.com/2013/04/radar-app-gets-killed-without-crash-log/#comments</comments>
		<pubDate>Tue, 30 Apr 2013 15:38:00 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Bug Reports]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8075</guid>
		<description><![CDATA[The following bug report has already been confirmed by Apple. Still I am posting it for the public so that it might help somebody who is getting the same problem. The workaround is to override the readFromURL:error: method of UIDocument instead loadFromContents:ofType:error: since the problem lies inside NSFileWrapper. While being very convenient to use on smaller documents having too many items inside an NSFileWrapper will cause the problem described in this bug report. Filed as rdar://13586175 and on Open Radar. Summary Frequent opening and closing of a UIDocument subclass (not using iCloud) leads to a silent termination of the app. Steps to Reproduce: have UIDocuments with hundreds of images in them open these UIDocuments and close them several times until the app is just gone Expected Results The app should not be terminated with signal 9. In the least a useful crash report should be created. Actual Results App is killed with signal 9, on the console this output is logged: Apr 5 15:47:22 Stefan-Gugarels-iPad iCatalogTest[2700] &#60;Error&#62;: shared connection error: Connection interrupted Apr 5 15:47:22 Stefan-Gugarels-iPad com.apple.launchd[1] (com.apple.librariand[2672]) &#60;Notice&#62;: (com.apple.librariand) Exited: Killed: 9 Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.launchd[1] (com.apple.tccd[2681]) &#60;Notice&#62;: (com.apple.tccd) Exited: Killed: 9 Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.launchd[1] (UIKitApplication:com.int-color.icatalogtest[0x114b][2700]) &#60;Notice&#62;: (UIKitApplication:com.int-color.icatalogtest[0x114b]) Exited: Killed: 9 Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.debugserver-199[2698] &#60;Warning&#62;: 1 +0.000000 sec [0a8a/1303]: error: ::read ( 5, 0x1c89fc, 18446744069414585344 ) =&#62; -1 err = Bad file descriptor (0x00000009) Apr 5 15:47:23 Stefan-Gugarels-iPad backboardd[26] &#60;Warning&#62;: Application 'UIKitApplication:com.int-color.icatalogtest[0x114b]' exited abnormally with signal 9: Killed: 9 Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: vnode: table is full Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: vnode: table is full Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: vnode: table is full Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: vnode: table is full Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &#60;Debug&#62;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage We suspect that this is a bug in the iOS SDK. Regression The problem started to occur when we switched to a UIDocument-based subclass for our document. Notes I am using multiple UIDocuments for displaying Catalogs. I open UIDocuments show them and close them. I am repeating the previous step until the app is killed with signal 9. (But i get no Crashlog and no Exception during Debugging). The only hint for me is found in iPad Console of device. We verified that the UIDocument is being deallocated after showing. We are not using file presentation, but only the asynchronous loading facilities of UIDocument. We are not using iCloud and we do not need to save the UIDocument. The out of vnodes condition seems to be related to using the NSFileWrapperReadingImmediate reading option of NSFileWrapper since we are able to show the termination both with an explicitly created file wrapper with this option as well as UIDocument. UIDocument appears to be using the same file wrapper reading option internally. If we change the reading option to NSFileWrapperReadingWithoutMapping then the problem no longer occurs. Even if this is &#8220;by design&#8221; then in the least we would expect for a useful exception to be raised such that an unsuspecting developer would have a clue how to work around that.]]></description>
				<content:encoded><![CDATA[<p>The following bug report has already been confirmed by Apple. Still I am posting it for the public so that it might help somebody who is getting the same problem.</p>
<p>The workaround is to override the <b>readFromURL:error:</b> method of UIDocument instead <b>loadFromContents:ofType:error:</b> since the problem lies inside NSFileWrapper. While being very convenient to use on smaller documents having too many items inside an NSFileWrapper will cause the problem described in this bug report.</p>
<p>Filed as rdar://13586175 and on <a href="http://www.openradar.me/radar?id=2990401">Open Radar</a>.<br />
<span id="more-8075"></span></p>
<div id="more-8075"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<h3>Summary</h3>
<p>Frequent opening and closing of a UIDocument subclass (not using iCloud) leads to a silent termination of the app.<br />
Steps to Reproduce:</p>
<ul>
<li>have UIDocuments with hundreds of images in them</li>
<li>open these UIDocuments and close them several times until the app is just gone</li>
</ul>
<h3>Expected Results</h3>
<p>The app should not be terminated with signal 9. In the least a useful crash report should be created.</p>
<h3>Actual Results</h3>
<p>App is killed with signal 9, on the console this output is logged:</p>
<pre>Apr 5 15:47:22 Stefan-Gugarels-iPad iCatalogTest[2700] &lt;Error&gt;: shared connection error: Connection interrupted
Apr 5 15:47:22 Stefan-Gugarels-iPad com.apple.launchd[1] (com.apple.librariand[2672]) &lt;Notice&gt;: (com.apple.librariand) Exited: Killed: 9
Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.launchd[1] (com.apple.tccd[2681]) &lt;Notice&gt;: (com.apple.tccd) Exited: Killed: 9
Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.launchd[1] (UIKitApplication:com.int-color.icatalogtest[0x114b][2700]) &lt;Notice&gt;: (UIKitApplication:com.int-color.icatalogtest[0x114b]) Exited: Killed: 9
Apr 5 15:47:23 Stefan-Gugarels-iPad com.apple.debugserver-199[2698] &lt;Warning&gt;: 1 +0.000000 sec [0a8a/1303]: error: ::read ( 5, 0x1c89fc, 18446744069414585344 ) =&gt; -1 err = Bad file descriptor (0x00000009)
Apr 5 15:47:23 Stefan-Gugarels-iPad backboardd[26] &lt;Warning&gt;: Application 'UIKitApplication:com.int-color.icatalogtest[0x114b]' exited abnormally with signal 9: Killed: 9
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: vnode: table is full
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: vnode: table is full
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: vnode: table is full
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: vnode: table is full
Apr 5 15:47:23 Stefan-Gugarels-iPad kernel[0] &lt;Debug&gt;: 1250 desired, 1250 numvnodes, 0 free, 0 dead, 0 rage</pre>
<p>We suspect that this is a bug in the iOS SDK.</p>
<h3>Regression</h3>
<p>The problem started to occur when we switched to a UIDocument-based subclass for our document.</p>
<h3>Notes</h3>
<p>I am using multiple UIDocuments for displaying Catalogs. I open UIDocuments show them and close them. I am repeating the previous step until the app is killed with signal 9. (But i get no Crashlog and no Exception during Debugging). The only hint for me is found in iPad Console of device.</p>
<p>We verified that the UIDocument is being deallocated after showing. We are not using file presentation, but only the asynchronous loading facilities of UIDocument. We are not using iCloud and we do not need to save the UIDocument.</p>
<p>The out of vnodes condition seems to be related to using the NSFileWrapperReadingImmediate reading option of NSFileWrapper since we are able to show the termination both with an explicitly created file wrapper with this option as well as UIDocument. UIDocument appears to be using the same file wrapper reading option internally.</p>
<p>If we change the reading option to NSFileWrapperReadingWithoutMapping then the problem no longer occurs.</p>
<p>Even if this is &#8220;by design&#8221; then in the least we would expect for a useful exception to be raised such that an unsuspecting developer would have a clue how to work around that.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8075&amp;md5=5197c0685c87ee070abdb56705c02211" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/04/radar-app-gets-killed-without-crash-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F04%2Fradar-app-gets-killed-without-crash-log%2F&amp;language=en_GB&amp;category=text&amp;title=Radar%3A+App+gets+killed+without+Crash+Log&amp;description=The+following+bug+report+has+already+been+confirmed+by+Apple.+Still+I+am+posting+it+for+the+public+so+that+it+might+help+somebody+who+is+getting+the+same+problem....&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>WWDC Ticket Aftermath</title>
		<link>http://www.cocoanetics.com/2013/04/wwdc-ticket-aftermath/</link>
		<comments>http://www.cocoanetics.com/2013/04/wwdc-ticket-aftermath/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 20:53:59 +0000</pubDate>
		<dc:creator>Drops</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.cocoanetics.com/?p=8068</guid>
		<description><![CDATA[The results the world had with Apple&#8217;s new plan where mixed. By a rough estimate over 20,000 developers where trying to storm the bastille at exactly 10 am PDT. But only a fraction was successful in winning the race, many just found a system in shambles. Theoretically the idea was wonderful: announce the time that ticket would go on sale the day before so that everybody can get ready, ask their bosses for final approval and be in front of an Internet-connected Mac with Credit Card in hand &#8230; I had made my personal bet at around half the time it took for sell-out to occur in 2013, around an hour or so. Maybe 30 minutes if Google IO was an indication. But never would I have believed if anybody told me that it took only slightly over 2 minutes for the Sold Out banner to appear. WWDC 2013 Ticket Flow Chart From the messages my colleagues around the globe has posted on Twitter and App.net I pieced together this flow chart that shows all the weak points in Apple&#8217;s plan. &#160; All the red post-its are areas where problems were encountered that we know about. I was trying to get two tickets, one for myself, one for my employee who has never been to San Francisco nor to WWDC. Since there was this rule that each Apple ID would have to buy its own ticket I didn&#8217;t dare to edit the quantity box which I noticed with surprise when I made it into the member center. Would I have gotten 2 if I had had the guts to turn the 1 into a 2? We shall never know. However, each team member must sign in with their own Apple ID and purchase their own ticket. In the meantime my colleague didn&#8217;t see the Ticket button on the portal and when he finally saw it, the LDAP server had already died from the DDOS attach comprised of tens of thousands of simultaneous login attempts of desperate developers. So he was stuck in Login Limbo before he could have entered Member Center. Logged In or Not Logged In Later it was revealed that Apple did have some sort of cookie lottery system which assigned tickets to people already on the portal. With this number all you needed to achieve is to log into the member center so that Apple would have had the information that your e-mail address has assigned a certain ticket number. Some people reported that their credit card company promptly barred their card as soon as they tried to pay for the ticket in their Apple Online Store shopping card. Only very few got lucky and were able to get to the orange bliss zone. But as mentioned before, if you had gotten as far as being logged in and having a low enough number in the queue then you would get a second chance. LUCK 2.0 if you will. Because of these people Apple would actually pick up the phone and inform them that there was a ticket reserved for them. To which most responded happily &#8220;Hell Yeah!&#8221; A Big Bag of Hurt Which leaves tens of thousands of developers who failed at any of the shown red post-its. I count myself amongst the LUCK 1.0 crowd, for which I am truly thankful. I had pleaded and begged Apple for a second ticket for my friend, my colleague, my best man&#8230; but as the weekend is nigh I am beginning to lose hope.  Oh well, there&#8217;ll be plenty other events for him to attend: #AltWWDC and CocoaConf being two first ideas. PS: If you lucked out, but now cannot attend WWDC for some reason &#8230; email me and I can try to get your ticket transferred to my employee &#8211; of course in exchange for the money you paid &#8211; provided Apple makes an exception to the non-transferable rule.]]></description>
				<content:encoded><![CDATA[<p>The results the world had with <a title="Apple announces WWDC 2013" href="http://www.cocoanetics.com/2013/04/apple-announces-wwdc-2013/">Apple&#8217;s new plan</a> where mixed. By a rough estimate over 20,000 developers where trying to storm the bastille at exactly 10 am PDT. But only a fraction was successful in winning the race, many just found a system in shambles.</p>
<p><span id="more-8068"></span></p>
<div id="more-8068"></div>
<div class="inner_ad_block">
<div id="advman-7" class="widget Advman_Widget">
<h3 class="widgettitle"></h3>
<p><!-- BuySellAds.com Zone Code --></p>
<div id="bsap_1260346" class="bsarocks bsap_fc3166ea4a479e0fdb4251fbe92a1219"></div>
<p><!-- End BuySellAds.com Zone Code --></div>
</div>
<p>Theoretically the idea was wonderful: announce the time that ticket would go on sale the day before so that everybody can get ready, ask their bosses for final approval and be in front of an Internet-connected Mac with Credit Card in hand &#8230;</p>
<p>I had made my personal bet at around half the time it took for sell-out to occur in 2013, around an hour or so. Maybe 30 minutes if Google IO was an indication. But never would I have believed if anybody told me that it took only slightly over 2 minutes for the Sold Out banner to appear.</p>
<h3>WWDC 2013 Ticket Flow Chart</h3>
<p>From the messages my colleagues around the globe has posted on Twitter and App.net I pieced together this flow chart that shows all the weak points in Apple&#8217;s plan.</p>
<p><a href="http://i2.wp.com/www.cocoanetics.com/files/WWDC_2013_Ticket_Flow.jpg"><img class="alignnone  wp-image-8069" alt="WWDC 2013 Ticket Flow" src="http://i2.wp.com/www.cocoanetics.com/files/WWDC_2013_Ticket_Flow.jpg?resize=577%2C610" data-recalc-dims="1" /></a></p>
<p>&nbsp;</p>
<p>All the red post-its are areas where problems were encountered that we know about.</p>
<p>I was trying to get two tickets, one for myself, one for my employee who has never been to San Francisco nor to WWDC. Since there was this rule that each Apple ID would have to buy its own ticket I didn&#8217;t dare to edit the quantity box which I noticed with surprise when I made it into the member center. Would I have gotten 2 if I had had the guts to turn the 1 into a 2? We shall never know.</p>
<blockquote><p>However, each team member must sign in with their own Apple ID and purchase their own ticket.</p></blockquote>
<p>In the meantime my colleague didn&#8217;t see the Ticket button on the portal and when he finally saw it, the LDAP server had already died from the DDOS attach comprised of tens of thousands of simultaneous login attempts of desperate developers. So he was stuck in Login Limbo before he could have entered Member Center.</p>
<h3>Logged In or Not Logged In</h3>
<p>Later it was revealed that Apple did have some sort of cookie lottery system which assigned tickets to people already on the portal. With this number all you needed to achieve is to log into the member center so that Apple would have had the information that your e-mail address has assigned a certain ticket number.</p>
<p>Some people reported that their credit card company promptly barred their card as soon as they tried to pay for the ticket in their Apple Online Store shopping card. Only very few got lucky and were able to get to the orange bliss zone.</p>
<p>But as mentioned before, if you had gotten as far as being logged in and having a low enough number in the queue then you would get a second chance. LUCK 2.0 if you will. Because of these people Apple would actually pick up the phone and inform them that there was a ticket reserved for them. To which most responded happily <em>&#8220;Hell Yeah!&#8221;</em></p>
<h3>A Big Bag of Hurt</h3>
<p>Which leaves tens of thousands of developers who failed at any of the shown red post-its.</p>
<p>I count myself amongst the LUCK 1.0 crowd, for which I am truly thankful. I had pleaded and begged Apple for a second ticket for my friend, my colleague, my best man&#8230; but as the weekend is nigh I am beginning to lose hope.  Oh well, there&#8217;ll be plenty other events for him to attend: <a href="http://altwwdc.com/">#AltWWDC</a> and <a href="http://cocoaconf.com/">CocoaConf</a> being two first ideas.</p>
<p>PS: If you lucked out, but now cannot attend WWDC for some reason &#8230; <a href="mailto:oliver@cocoanetics.com">email me</a> and I can try to get your ticket transferred to my employee &#8211; of course in exchange for the money you paid &#8211; provided Apple makes an exception to the <a href="https://developer.apple.com/wwdc/more/#attendance">non-transferable rule</a>.</p>
 <p><a href="http://www.cocoanetics.com/?flattrss_redirect&amp;id=8068&amp;md5=e83205636774460ad1a3c1bc6ab35105" title="Flattr" target="_blank"><img src="http://www.cocoanetics.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.cocoanetics.com/2013/04/wwdc-ticket-aftermath/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=dr_touch&amp;url=http%3A%2F%2Fwww.cocoanetics.com%2F2013%2F04%2Fwwdc-ticket-aftermath%2F&amp;language=en_GB&amp;category=text&amp;title=WWDC+Ticket+Aftermath&amp;description=The+results+the+world+had+with+Apple%26%238217%3Bs+new+plan+where+mixed.+By+a+rough+estimate+over+20%2C000+developers+where+trying+to+storm+the+bastille+at+exactly+10+am+PDT.+But...&amp;tags=blog" type="text/html" />
	</item>
	</channel>
</rss>
