While Steve Jobs was on stage unveiling the first iPhone for the world, the engineers behind the device were in the audience halfway drunk, says a new report that takes a look behind-the-scenes of the development of the most popular smartphone in the world.

The engineers and managers were downing Scotch in the fifth row of the Moscone Center as Apple's co-founder demonstrated an aspect of the iPhone. According to a new write-up in The New York Times Magazine, they were all quite nervous that the still-incomplete iPhone prototype would fail to perform some task during the demonstration, and whoever had been responsible for that feature prior to the demo would later have to suffer the wrath of Jobs.

The Times' look back at the development of the iPhone reveals a process filled with setbacks, glitches, and obstacles. Andy Grignon, a senior radio engineer at Apple, contributes a first-hand perspective on the process, one filled with stress and high stakes.

âAt first it was just really cool to be at rehearsals at all â kind of like a cred badge,â Grignon said of the rehearsals that preceded the actual iPhone unveiling. âBut it quickly got really uncomfortable. Very rarely did I see him become completely unglued â it happened, but mostly he just looked at you and very directly said in a very loud and stern voice, âYou are [expletive] up my company,â or, âIf we fail, it will be because of you.â He was just very intense. And you would always feel an inch tall.â

Before those rehearsals, Apple was on lockdown. Apple is well known for its culture of secrecy, and the development of the iPhone was no different. Engineers were asked to sign non-disclosure agreements before they could even be told what they were working on, and then they were asked to sign documents reaffirming the previous agreements. "Rockstar" employees began disappearing from their departments, only to be seen later entering rooms with badge scanners and multiple other levels of security. The secrecy was aimed at preventing any leaks of what employees would soon find out was a "moon shot" of sorts for the then-iPod maker.

"It had been drilled into everyoneâs head that this was the next big thing to come out of Apple," Grignon said, as the iPhone was essentially the only big, new product Apple had been working on at the time. âIt was Apple TV or the iPhone... And if he had gone to Macworld with just Apple TVâ â a new product that connected iTunes to a television set â âthe world would have said, âWhat the heck was that?â â

The iPhone project â which would eventually cost $150 million to create, by some estimates â produced a number of prototypes. Among them was a device that looked like a joke slide Jobs showed before introducing the real iPhone: an iPod with a rotary dial in place of the click wheel. That design was rejected, as it "was not cool" in the way Apple wanted its products to be.

The team behind the iPhone's development came to realize that their earlier idea that building the device would be like building a small Mac was quite off the mark. Issues arose with battery life, the multitouch interface, and even build materials. Jobs and Apple design guru Jony Ive initially designed an iPhone made entirely from brushed aluminum; they had to be gently let down by Apple's antenna experts that such a design would block radio waves, rendering the device "a beautiful brick."

âAnd it was not an easy explanation," said Phil Kearney, a former Apple engineer. "Most of the designers are artists. The last science class they took was in eighth grade. But they have a lot of power at Apple. So they ask, âWhy canât we just make a little seam for the radio waves to escape through?â And you have to explain to them why you just canât.â

By the time the actual device was unveiled in San Francisco, nerves were frayed throughout the development team. The process was fraught with slammed doors, shouting matches, and exhausted engineers quitting in a huff, only to return once they had gotten a few nights' sleep. When the finale came â and it worked along with everything before it, we all just drained the flask.

The device that Jobs actually took onto the stage with him was actually an incomplete prototype. It would play a section of a song or video, but would crash if a user tried to play the full clip. The apps that were demonstrated were incomplete, with no guarantee that they would not crash mid-demonstration. The team eventually decided on a "golden path" of specific tasks that Jobs could perform with little chance that the device would crash in the actual keynote.

Jobs took the stage on January 9, 2007 in his trademark black turtleneck and jeans, saying "This is a day I have been looking forward to for two and a half years," before showing off Apple's revolutionary take on the phone. Grignon, by that time, was drunk, having brought a flask in order to calm his nerves. As Jobs swiped and pinched, some of his staff swigged and sighed in relief, each one taking a shot as the feature they were responsible for performed without a hitch.