Our DNA is written in Objective-C

Cocoanetics Portal 2 Raffle

Fans of this blog and twitter followers alike will have a chance to get a free copy of Portal 2 on Steam. This highly anticipated game will be released on April 19th, round about the time when @Cocoanetics will surpass 2500 followers on Twitter.

When I went to Steam to pre-order my copy I saw an offer to buy two copies and give one away. So I thought that this might be a nice way to say “thank you!” for you being a frequent visitor to my blog and for following me on twitter.

To participate all you need to do is tweet the following text. On April 19th I will have tweetaways select a random winner from all the ones who tweeted the correct phrase.

Portal 2 Giveaway by @cocoanetics (BTW a great source for iOS dev info): http://bit.ly/g5nsKG #raffle

Good Luck!

MyAppSales 1.0.19

The latest HotFix committed to the MyAppSales GitHub repo contain a fix for an AJAX change on iTunes connect.


  • Fixes a problem where only the first daily or weekly report would be downloaded.

The problem started to occur because apple added a javascript function call into the method to switch between days and weeks. Something to do with rate limiting, I think they now disable the download button while the AJAX request is ongoing.

Development of version 2.0 is still ongoing, you can sneak a peak on the development branch. There are a couple of  things to do before I can merge it back into master: changing the charting to DTChartView and doing the summing per app on a background thread.

In the future I am still hoping that the Open Source community will get a bit more involved than it has been. i.e. totally hands off. I’ve open sourced MyAppSales precisely because I was hoping for contributions, but I have yet to see the first.

Splitting a String into Paragraphs … with Blocks

I found myself in need of splitting an NSString into paragraphs. Or more precisely to analyze a string and find the NSRange for each such paragraph. At first I wrote a C-style function that looked for the ‘\n’ in the NSString’s utf8String, but it turns out that this approach has problems with multi-character UTF8 sequences.

For the longest time I shirked from using Blocks, which became part of iOS with iteration 4.0. But since this project will have a minimum deployment target of higher than this, I gained the ability to use a block-based enumeration function to achieve my goal with a record minimum of code.

Read more

Apple and Cocoanetics Reach Licensing Agreement

CUPERTINO, California; VIENNA, Austria —April 1, 2011—Apple® and Cocoanetics.com are jointly announcing today that a licensing agreement has been reached that will allow Apple to distribute the highly acclaimed software components of Cocoanetics.com to registered iOS developers worldwide as sample code. Two specific components for displaying a calendar interface (DTCalendarView) and for displaying charts (DTChartView) will be merged with the upcoming iOS SDK 5.0.

“We wanted to make a joint announcement at WWDC this year, but since the information on this deal has already been leaked it is my pleasure to announce the details of this wonderful partnership.” said Philip Schiller, Apple’s senior vice president of Worldwide Product Marketing. “If you are an iOS or Mac OS X software developer, then you know that you can definitely learn from Cocoanetics.”

Apple is also looking at merging the technology from Cocoanetics.com open source project NSAttributedString+HTML into iOS SDK 5.0, but due to the open source nature of the project there are licensing ramifications that need to be worked around. Lawyers of both companies are working to find a way to make the source code proprietary to Apple while exposing the API as native option to developers.

“The Mac always had this great way to make attributed strings from HTML and while iOS 3.2 brought CoreText to the mobile platform this was the missing link to enable developers to ditch UIWebView once and for all,” said Oliver Drobnik, CEO and chief developer at Cocoanetics.com.

Apple designs Macs, the best personal computers in the world, along with OS X, iLife, iWork and professional software. Apple leads the digital music revolution with its iPods and iTunes online store. Apple has reinvented the mobile phone with its revolutionary iPhone and App Store, and has recently introduced iPad 2 which is defining the future of mobile media and computing devices.

Cocoanetics.com blogs about topics that are of interest to iOS developers worldwide, produces high-quality software components, produces and publishes apps for the App Store and provides consulting and contracting services for clients worldwide. Fashion catalog publishers use Cocoanetics’ iCatalog technology to publish digital versions on iPad.

Press Contacts:
Bill Evans
(408) 974-0610

Oliver Drobnik

Read more

Cloning a Git Repo with Submodules

I was setting up a project with one submodule on my working iMac and was wondering how to do this most quickly. After tweeting the approach I had found, there where quickly some very smart people responding on how to do that better. I found this kind of crowd-sourced incremental improvement exhilarating, so I’m sharing it with you.

Read more

State of our iOS Nation

I just returned from my visit to San Francisco, where I helped Scribd on iOS-related matters. I’m sitting in a quiet restaurant near the railway half way between Vienna and Salzburg. There I’m awaiting the arrival of somebody I’m coaching, again related to iOS development. I find this to be a nice diversion from coding hours on end, and it’s especially welcome being throughly jetlagged. Flying east is said to be especially tiresome.

Too many Developers …

I consider it a good omen. After having touched down in Vienna, I boarded a train to where I live, 2 hours from Vienna. The next day, when I opened my laptop to start dealing with a large backlog of e-mails, I found that Apple has finally decided to start selling WWDC tickets. We think they had like 5000 seats available, which – after having removed all discounting options last year – where sold for $1600 a pop. Not too shabby, that’s like 8 Million Dollars made. More for Steve’s treasure chest, Apple has been sitting on a pile of cash assets for the longest time.

Read more

How Safe is Square?

Innovative startup Square continues to make waves with their app and reader combo that enables small-time businesses to access payment with credit cards. Imagine somebody with a camping table and self-made T-Shirts selling these on the street. For example I would have loved a T-Shirt to commemorate 2 weeks of iPad2 queues saying “I queued for iPad 2, but all I got is this lousy T-Shirt”. Without hesitation my Mastercard would have jumped out of my wallet to make love to a Square reader and app.

But then there are the established companies which feel threatened by Square. First and foremost VeriFone, a company that apparently seems to see themselves as the sole owner of the market for processing payment information. This is evidenced by the statements made on their website. Take for example their SEO-friendly site title: “VeriFone Official Site | Secure payment solutions for credit & debit cards, EMV, contactless, & NFC”. They have vested interests in technologies that require you to purchase their products.

Let’s have a closer look what’s behind this rivalry and also investigate if there really is a gaping security hole in Square’s approach as VeriFone claims.

Read more

Expanding/Collapsing TableView Sections

While giving many designers a headache the Twitter app still serves as template on how to solve a variety of UX riddles. One of which is the situation where one might want to have sections in a tableview that possess the ability to expand from one row to several and collapse vice versa.

The eye of the experienced developer sees two challenges contained therein: 1) grafting a mechanism for collapsing and expanding onto UITableView in a reusable way 2) making custom accessory views that look like a rotated version of the disclosure indicator, pointing upwards or downwards and also changing color when highlighted.

In this article I present my solution to this UX riddle. At the same time I will demonstrate how NSMutableIndexSet can be used to our advantage. In contrast to the pull-to-reload method previously discussed, this does not contain anything remotely patentable.

Update March 12th, 2013: Cleaned up version of the custom-colored accessory is now available via DTFoundation, the example project is now part of our Examples collection on GitHub. Please note that if you use this code you have to attribute it to us or buy a Non-Attribution License.

Read more

On Meeting Other Developers

Everywhere I travel I generally try to find some local meetup of iOS developers to hook up with. Let me be honest, admittedly, one of the reasons why I like to do this is that often developers would mention in passing that they have heard about my blog or know me from following me on twitter. One word: ego.

But this is not the sole reason for this interest. I am possessed by the idea that if developers in any field – iOS in my case – would organize and socialize more then the resulting network of knowledge and opportunities would generally benefit everybody. I might tend to extremes, here I am working out of my home office for the most part talking about the greatness of a social network.

Read more

Git Submodules and Xcode 4

Previously when integrating existing library code with new projects I would have simply copied the necessary groups from from Xcode project to another. Then I would choose to copy the files to the new project to be sure that they got included in the source tree. Otherwise the project would not build for other people accessing the same source control management (SCM) server.

Now with Xcode 4 this technique no longer works. You simply cannot drag groups between workspaces. The question that interests us today is how we can add an existing GitHub project to our own.

Let’s see if we can figure out a simple and duplicatable method to achieving this. It would make our lives much easier to not having to duplicate component code for each new project.

Read more