The Xcode 5.1 update proved to be more exciting than I anticipated. And I mean “exciting” in the sense of “breaking the tools I use.” xctool stopped working, and so did my code coverage scripts.

XcodeCoverage - code coverage for Xcode

Hole” by Bart Everson, used under CC BY 2.0 / Cropped

(Lesson learned: Always download the developer preview and give it a try, before running Software Update…)

Facebook updated xctool. And I’m happy to say that XcodeCoverage now works with Xcode 5.1! Thanks to my coworker Mike Maietta for figuring out how to create a wrapper around the new gcov so that it continues to work with lcov.

Your coverage numbers may change slightly as you use Xcode 5.1 — but not much. And we don’t need the __gcov_flush() workaround anymore. Hurrah! Continue Reading…

For my European readers: I have two speaking engagements coming up in January 2014. The first is with Mobile Central Europe in Warsaw on January 11. I’m honored to be part of this brand new developer’s conference! Here’s the cool conference trailer:

Then after an eBay iOS Developer Meeting in Berlin on January 13 (for eBay Inc. employees only), I’ll be speaking at eBay Tech Talk in Berlin on January 14 (open to the public).

I hope to meet some of you soon!

September Update: I capped things off with iOSDevUK and NSSpain.

Update: Apple took this to heart, and fixed things in Xcode 5.1.

Bug or feature? “You have to call __gcov_flush() to collect coverage data with the iOS simulator.” According to Apple, this is a feature. But not if you actually want to measure your code coverage.

Code coverage ERROR: no .gcda files found

But it worked on Xcode 4 / iOS 6…

Code coverage… oy vey! Back in the days of running on iOS 6 using Xcode 4, measuring code coverage for unit tests was fairly straightforward. A set of coverage scripts I published made it easier still.

Then along came iOS 7 and Xcode 5. Coverage still worked if you continued to run on iOS 6. But on iOS 7, you’d get “ERROR: no .gcda files found” indicating that coverage data wasn’t being captured. “Well, maybe I need to switch from SenTestingKit to Apple’s new XCTest framework.” Nope, that didn’t help. Continue Reading…

Dot notation is okay, after all.

There, I said it.

I’ve been a staunch opponent of dot notation. I saw it as obscuring messaging, and encouraging programmers to violate the Law of Demeter through chained dots. I went so far as to characterize dot notation as an Objective-C code smell.

So it may surprise you to learn that I’ve recently adopted dot notation in my code! Here’s how it happened…  Continue Reading…

Remember my iOS Model-View-Controller TDD screencast? Eric Baker took it a few extra steps with his own follow-up screencast, demonstrating:

There’s a lot of interesting stuff here. But I also want to acknowledge that this screencast changed my mind about dot notation. Yes, really!

What are your thoughts about ReactiveCocoa, Kiwi, or AppCode? Leave a comment below.

NSBrief is a fun and informative podcast about Cocoa “developer-y topics.” I’m honored that I had my moment of glory on Episode #97: Jon Reid.

NSBrief

Host extraordinaire Saul Mora and I had an hour-and-a-half conversation about iOS unit testing, test driven development, and such.

There are a quite a few other episodes, but I’d like to recommend two in particular relating to testing:

Do you have any questions about anything we said during the podcast? Leave a comment below.

People assume you can’t write unit tests for user interface code. That just ain’t so. I’ve already shown you how to do UIViewController TDD. Can we do the same for UIAlertView and UIActionSheet? Sure!

UIActionSheet example

This time instead of a screencast, I’ve put my code on GitHub, because you’ll want to incorporate some classes into your tests. Go to my iOSAlertViewActionSheetUnitTesting repository. Continue Reading…

CocoaConf vs. WWDC

April 22, 2013 — 2 Comments

I just wrapped up a great weekend with CocoaConf San Jose. I’ve gotta say: if you’re looking to maximize bang for your buck, save the money you’d spend on WWDC and consider CocoaConf instead!

cocoaconf

First, there’s the stress of trying to get a WWDC ticket. Then the expense. Sure, there are all those great talks, but Apple makes the videos available to registered developers. I think the main reason to continue going to WWDC is if you’re really desperate to get help in the Apple labs.

I’d never been to another iOS/Mac developer’s conference before this past weekend. I was impressed by:

  • The small size. With only a hundred developers, there were many opportunities to build relationships, even with the speakers.
  • The speakers. This is a class act of experienced people. Many of them are published authors. They’re there because they’re passionate about their craft.
  • The food. Remember when WWDC food used to be decent, before the iOS-induced population explosion? This was like that, only better. Much better.
  • The duration. My brain is full by the third day of any conference. CocoaConf wisely stops there.
  • The price. Way cheaper.

I came away having learned good stuff. But maybe just as important, I made genuine human connections. (Good luck doing that at the great cattle-herding of WWDC.)

CocoaConf is a traveling conference, hitting up several cities in the U.S. You owe it to yourself to check out the one nearest you.

Question: What are your favorite conferences, and why? Leave a comment below.

There are subtle issues around #import order. You may not believe me — until you try reusing code in a new project.

missing #imports

Unfinished Bridge 1” by Jason Thomas, used under CC BY-NC-SA 2.0 / Altered by Jon Reid

In #imports gone wild! we looked at the problems caused by having too many #import directives. But it’s also possible that you have too few, resulting in bad header files — especially if you don’t pay attention to #import order in your .m files.

Minimal and complete

When it comes to imports, header files should satisfy these two conditions:

  • They should be minimal
  • They should be complete

“Minimal” just means a header file should import no more than it needs.
“Complete” means the header file imports everything that needed to compile it. Consider Continue Reading…

The UIViewController TDD screencast ended with all the code in the view controller. Unfortunately, this is where many iOS programmers leave things! Let’s TDD our way to something better…

In part 2, we pick up from there and TDD to extract a model class, which the controller observes. You’ll see it evolve into true Model-View-Controller, driven by unit tests.

In particular, you’ll see how to TDD:

  • a model that posts notifications when it changes, and
  • a controller that observes those notifications.

Continue Reading…