Working without a nib, Part 7: The empire strikes back

I recently received an email from Steve Jobs. He told me that he has read all of my blog posts. I found this ridiculous, so I replied, “You’re full of it!” Shockingly, he wrote back. “Actually,” he said, “all of the new apps of the past few years are nibless.” He then described the Apple-sanctioned technique of writing a nibless application.

In previous posts of this series, I was forced to use obscure workarounds such as +[NSObject poseAsClass:] and method_exchangeImplementations() to prevent NSApplicationMain() from trying to load a nib. Jordy Rose of Belkadan Software suggested to me that the easiest way to prevent NSApplicationMain() from trying to load a nib would be to avoid calling NSApplicationMain() at all. Instead, you would just call -[NSApplication run]. However, I was worried that NSApplicationMain() might do something else important (like phone home to get permission to launch). We don’t know, because we don’t have the source code.

I’m still waiting for the source code, but Steve did indicate that it was safe to skip NSApplicationMain(). Thus, there’s no need for tricksy runtime manipulation, except perhaps to prove your mad programming skills. Mad, that is, in the sense of having worn one ring for too long. Steve also affirmed that our call to -[NSApplication setAppleMenu:], a method that Apple removed from the API, will continue to work until there’s a replacement API. Indeed, Apple is working on some kind of replacement. Excellent! /me plays air guitar. So if you’re counting at home, it’s now (1) Exchange support and (2) Nibless support.

He didn’t mention the Open Recent menu, so it appears that my ugly hack is still required for non-document-based apps. This cannot be considered part of the Apple-sanctioned technique, though it is sanctioned by me, which is more desirable, because my approval comes in seven delicious flavors. I’ve updated Nibless for Leopard in light of Steve’s revelations and am making version 2.0 available for immediate download. This is major progress, because it already puts me two versions ahead of VLC.

So long, Steve, and thanks for all the fish!

5 Responses to “Working without a nib, Part 7: The empire strikes back”

  1. Jon Bell says:

    I’m new to Cocoa and your blog was recommended as a good resource.

    But I have to clarify — you really got an email from Steve Jobs? He really knows enough about code to talk intelligently about these issues?

    I’m assuming sarcasm but I can’t tell :)

  2. Jeff says:

    Recommended by what crazy person? ;-)

    I can’t lie to you, Dean Martin. Yes, it is Steve Jobs.

  3. Chase says:

    You don’t know HOW HARD it is to find ANY information about avoiding nibs online. I don’t know what people like about IB, but I just don’t like it at all. And if you ask a question about nibless programming, you get the “you should really reconsider” speech. This post was really helpful!!

  4. Kyle Sluder says:

    Chase: what people like about IB is that it’s what you should be using. It’s what the framework expects you to use, and fighting the framework is never a good idea, for a very, *very* large value of “never.”

  5. chris says:

    For a code snippet see here:

    Nibless Window Example