So I Got a Defective T-Mobile G1

Just after I got my iPhone, my wife heard the announcement of the T-Mobile G1. She knows I’m an open source kinda guy, and she’d heard me complain about the then-awful iPhone SDK agreement, so when she heard the announcement, she came down to my office and told me about it (I’d heard it already), and said, “This sounds just like you! You should get one and develop for it!” So I placed my preorder immediately. (Thanks, Sweetheart!)

When it arrived, I was delighted. Neat stuff, though I need to do a full review – the iPhone is definitely more polished at this point.

However, my particular phone had a small problem – a column of pixels about 15 pixels in from the left edge of the screen is defective.

This let me contact T-Mobile phone support on day 1 of the G1 event.

I spent about an hour on the phone (had to call from another phone, because the first representative told me they’d have to open up the phone, look under the battery, etc. – but they never did). I spoke with representatives from customer support (4), technical support or PDA support (2), and somebody dealing with returns but it was his first day and he eventually decided I’d been routed to him by mistake. My favorite line from him was, “How did you get it already?” (My answer: T-mobile shipped it to me??)

Anyway, T-mobile eventually came through and sent me a new G1, and it does not have the pixel issue, so I’m going to send the other one back RSN (Real Soon Now).

Thanks, T-Mobile!


Leave a Comment

So I built an iPhone application in xCode without $99

I’m developing for the iPhone, and I even got a Macbook, but I don’t really want to start my $99/year until I’m ready to publish something to the AppStore. So, how do you develop with xCode for the iPhone, without an Apple Developer certificate?

  1. Download and install xCode and the SDK from the iPhone developer center. Run the installer.
  2. Create a self-signed certificate on your mac.

    Start Keychain Access: Open Finder, Utilities (shift-command-U), Keychain Access. Then Keychain Access, Certificate Assistant, Create a Certificate. Enter the name “iPhone Developer”, Self Signed Root, and check Let me override defaults. Continue, and Continue again – that you’re creating a self-signed certificate.

    Serial number 1 should be fine, make the validity period longer so you don’t have to mess with this again (3650 days sounds good…), and choose Certificate Type: Code Signing. Continue, enter an email address, I put “iPhone Developer” in the certificate information here, too, and then just hit Continue until it creates the certificate.

  3. Download a project of your choice from the Apple iPhone developer pages (I grabbed WhichWayIsUp). Open the .dmg and copy the files (or the .zip and extract the files) into a directory you can edit (I put it under $HOME/Documents).
  4. Open the xcode project file (or the project file from xcode).
  5. Turn off built-in code signing: open Project settings (Project | Project settings). Choose the Build tab. In the Code Signing section, for Any iPhone OS Device, erase the name “iPhone Developer” and leave it blank.
  6. The jailbroken iPhone still needs the code to be marked as “signed” (or the application gets killed on startup), so add a custom build step to sign the executable (you’ll need to do this for each project – and I haven’t found where to update it after adding it…):

    Download and place it in $HOME/bin. Make it executable (chmod 755 $HOME/bin/

    Add the build step to execute

    Project | New Build Phase | New Run Script Build Phase

    Add the following script code (note that you need to update $HOME/bin depending on where you put You may also want to update the text):

    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
    	codesign -f -s "iPhone developer" --resource-rules "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/ResourceRules.plist" \
  7. Choose the iPhone as the Active SDK: Project | Set Active SDK | Device – iPhone OS 2.1
  8. Build the project (command-B). If prompted, allow the use of the iPhone Developer key to sign the code. (I choose Always allow).
  9. Copy the built file to the iphone (update text as needed): scp -r ~/Documents/WhichWayIsUp/build/Debug-iphoneos/ root@miphone:/Applications
  10. Refresh the Springboard cache. You can do this in several different ways. Pick one:
    • Install or update an application via Cydia or AppStore
    • Use the Cydia application “Respring”
    • In the Cydia package “BossPrefs” touch the Power icon, then “Fast Respring”

  11. Your application should show up in the Springboard. Run it, and enjoy. (Or be disappointed that the box in WhichWayIsUp doesn’t rotate smoothly, but only switches to vertical/horizontal. *sigh*)

Much of the detail of this process and the script came from Sylvain Munaut – Thanks! Note that I did not need to install the binary patches he lists at the end of his process.

Comments (11)

So I read the new Apple iPhone SDK Agreement

It’s much better than the old one.

Apple removed the non-communicate clauses (except you still can’t be first to disclose pre-release information).

Of interest, they also removed the “can only use the SDK on Apple-labeled hardware” clause. I had privately speculated that the tying of the Apple Market to Mac OS to Apple-labeled hardware would be a violation of anti-trust law – leveraging one monopoly to promote another monopoly (“tying”).

It looks like Apple has rescinded this tying arrangement, but retains the Mac OS license restriction to only use Mac OS on Apple-labeled hardware. I’ll have to address that sometime in another post, but I believe that restriction is invalid, as a monopoly tying arrangement in a contract of adhesion.

Leave a Comment

So I opened the Mac menus with the keyboard

I bought a used Macbook off eBay, to do iphone development. And ’cause I’ve been interested in the platform for a while.

Never used a Mac much before, and I’m trying to find all the keyboard shortcuts to keep my finger off the trackpad…

How do I access the menus with just the keyboard? Lifehacker gives the tip that you can do it with ctrl-f2 for the menu, and ctrl-f3 for the Dock. However on my Macbook, those affect sound & display, so you have to do ctrl-fn-f2 and ctrl-fn-f3. Contortionist, and it just opens the Apple (System) menu and you use arrow keys from there, but at least I don’t have to use the trackpad…

Comments (1)

So I had to force reset my iPhone (force shutdown/poweroff)

If your phone locks up, is unresponsive, and won’t go to sleep, etc., you probably need to reset it by forcing a shutdown. This happens occasionally with stock or jailbroken iphones, original and 3G. This crash may occur more frequently in low disk space conditions.

This isn’t a painful procedure and doesn’t lose your data – it just takes a minute.

Hold down the “home” and “sleep” buttons for several seconds (about 10). You may see the “Slide to poweroff” screen appear. The screen may go black. Don’t let go until you see the apple logo (or pineapple logo for jailbroken phones). Let go and wait a minute, and your phone will boot up normally.


Leave a Comment

So I Found Ways to Develop for iPhone

To develop for the iPhone, you have a few choices:

Web applications


  • choose your tools, choose your development platform
  • can make it available to non-iPhone users
  • requires connectivity


  • requires a hosting provider
  • limited to safari interface (i.e., tap, rotate, two-finger scroll, pinch zooming, no accelerometer, little iphone glitz)

Toolkits available:

Additional tools/techniques:

  • Web clip bookmark icon create an icon for use in the home screen (hit + in Safari, then “Add to home screen”)
  • Data links allow you to encapsulate webapp and state in the URL. Provides a mechanism to save a “bookmarklet” (“webclip”) that encapsulates the application. If we can also sync back to the online application, that would complete the round-trip.
  • iPhone in Action book has discussion of tradeoffs of web vs native applications

Native applications via the Apple SDK


  • best tools available, including the simulator
  • access to all documented iPhone SDK features
  • publish your application in the AppStore
  • lots of books published or being written


  • iPhone only
  • Limitations on application functionality from iPhone SDK agreement (no interpreters, no plugins, …)
  • Requires Apple approval of application for listing in AppStore
  • Requires signing a non-disclosure agreement (NDA)NDA lifted!
  • requires Mac OS X as development platform

Toolkits available:

Native applications via the open source tools


  • no NDA to sign
  • develop on your platform of choice
  • full access to anything the community has discovered
  • (possibly more than the documented SDK)
  • you can even develop ON the iPhone


Toolkits available:

So, there you have it. Three options.

What will you do?

Comments (1)

So I Don’t Like System.Net.HttpListener

…or at least, I disagree with a design choice made in a class it uses – System.Net.EndPointManager

Backstory (Exposition)

I’ve been doing some work with the generally excellent Dekiwiki. It’s a descendant of MediaWiki, of WikipediA fame. (Does anyone actually capitalize the “A” in WikipediA? I just noticed it on the logo on their website. Really. Never saw it before. Anyway, back to our, umm, backstory…)

Dekiwiki provides some neat extension capabilities, and a useful REST API, and a really cool web service framework. Oh, and it comes with a wiki, too.

Inciting Incident

But I noticed that the dekiwiki API process (running in mono) listens on all interfaces of its port – not just localhost:

netstat -anp | grep 8081
tcp 0 0* LISTEN 31194/mono

Well, that was disturbing, because it means people from the Internet (you know, “bad guys”) can connect to this internal process.


There’s a configuration value that looks like it should limit it, in /etc/dekiwiki/

# Port the API listens on

# hostname to listen on

Rising Action

But it doesn’t.

Digging into the code (gotta love open source…), I found that it was just using the HttpListener class from Mono. HttpListener delegates to EndPointManager, which includes this code:

// Always listens on all the interfaces, no matter the host name/ip used.
EndPointListener epl = GetEPListener (IPAddress.Any, lp.Port, listener, lp.Secure);


And sure enough, some experimentation with IronPython and .Net on Windows

    from System.Net import *
    l.Prefixes.Add( "http://localhost:8080/" )

showed that Microsoft works the same way.

netstatp -an | grep -B2 8080
[TCP] ipy.exe:3656



I can understand why – Microsoft wants the HttpListener class to work like virtual hosts in an HTTP 1.1 environment, so you can distinguish URL requests for different web applications by hostname, but that doesn’t mean the “bind sockets only to the appropriate interface” principle isn’t valuable, too.

But at least if you request something over that socket from an external host, you won’t match the specified URL prefix, so you’ll get an error. That’s something anyway. And you can always set up firewall rules to block the port…


Comments (1)

So I Installed git and git-svn on Cygwin

Sometime I’ll have to tell you about why I chose git.

Installing on cygwin wasn’t too bad. Had a few problems, though.

A little background

  • git is an open source, distributed version control system, originally created by Linus Torvalds, and greatly enhanced by the open source community.
  • svn or Subversion is an open source, centralized version control system.
  • git-svn is a git command to let you use the distributed functionality of git, and interact with the centralized world of subversion.

Cygwin setup

Running cygwin’s setup program gives you a GUI package installer. I like to use the xmission mirror, both because it is geographically close by, and because it is fast.

After all the preliminaries, click the “View” button to get an alphabetical list of packages, and expand the window so you can see a bit more. (I’m SO grateful cygwin finally made the window expandable, that I feel a bit guilty complaining that the initial window size is still too small…)

You’ll need at least the git, gitk, perl, and subversion-perl packages, and there’s lots of other good stuff there, too – like a full X-Windows system.

These required packages will also install a lot of other dependencies, so be prepared to wait a bit while it downloads and installs everything.


I also needed to download from CPAN into my c:/cygwin/lib/perl5/site_perl/5.10/ directory. (Thanks, Martin Carpella!)

Run git-svn

After everything is installed, you should be able to run git-svn. Note that there are two ways to run git-svn:

  1. git svn runs the wrapper program (git) which spawns the svn submodule
  2. git-svn runs the svn submodule directly

The installation process put git in /bin and git-svn in /usr/sbin/git-core/. I didn’t want to add that directory to my path, so I just run git svn.

Using git-svn

Andy Delcambre describes a basic workflow to use git-svn. There’s a more detailed description on

Some Problems

  • subversion-perl or perl not installed. Use the cygwin setup program.
    git: 'svn' is not a git-command. See 'git --help'.
  • Perl not found or not installed (I reinstalled perl using the cygwin setup program):
    /usr/sbin/git-core/git-svn: /usr/bin/perl: bad interpreter: No such file or directory
  • Need to download, or need to place it in the @INC path:
    Can't locate in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/5.10/i686-cygwin /usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at /usr/lib/perl5/vendor_perl/5.10/ line 100.

Leave a Comment

So I Doubt We’ll Get Flash or Java on the iPhone

…at least, not in their current forms.

There’s been some buzz about Flash coming to the iPhone. The problem is, that the problem is not technical – for both Flash and Java.

The Backstory

First some history:

  • Apple (Steve Jobs) has said that Flash is too big and slow on the iPhone, and that Flash Lite is too cut down, and thus not useful
  • Jobs also says that “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.” NY Times
  • Adobe has been pushing to get Flash on the iPhone, saying “it works”, etc.
  • Sun committed to provide Java on iPhone with the SDK, but when they saw the SDK restrictions, they had to backpedal to provide Java on the iPhone “if at all possible.”
  • Apple didn’t want to provide a native apps SDK – keeping all app development in-house.
  • Apple only provided a native apps SDK when it became clear that the jailbreak apps were wildly popular, completely outside Apple’s control, and thus threatening to take control of the iPhone platform away from Apple
  • Apple provided the SDK with very stringent restrictions – both the NDA, which has since been reluctantly lifted, and strict limitations on the applications developed with the SDK – including requirements that applications do not call any non-SDK APIs and do not download executable code or provide any interpreters. This last restriction is aimed directly at technologies like Flash and Java that execute code from third parties.

Apple the Monopolist

This pattern makes it clear that Apple is very intent on keeping control of the applications provided on the iPhone platform. They have some legitimate reasons for this (i.e., protecting their brand, protecting the user experience, protecting the cell network of their carrier partners), but I think the dominant reason is just protecting their very profitable monopoly.

Apple has a monopoly on the distribution of iPhone applications (barring the jailbreak apps), and they are determined to retain that. This monopoly is what allows them to do that other protection – of brand, experience, and network. It also is what allows them to charge every application developer 30% of revenue plus $99 per year. And what allows them to prevent applications that compete with iTunes, another big money maker. And also what allows them to limit iPhone development to being done on Apple hardware, another big money maker.

I’m quite confident that both Sun and Adobe have been working the back channels to convince Apple to allow Java and Flash on the iPhone, but that Apple will not budge.

What Will Work

I see three things that can get Apple to change their position:

  • Widespread public outcry for the other technologies. This seems to be what Adobe and Sun would be hoping for. However, Apple doesn’t really listen to customers. “Uncle Steve knows best.” The only leverage Apple customers have is their dollars, hence the next two possibilities.
  • Widespread adoption of a competing platform – namely, Google’s Android. This could be viewed as the ultimate loss for Apple – thousands, millions of potential customers going with a competing platform – but Apple has played the elite-user-friendly-minority-platform-where-we-have-a-monopoly role before, and I think they’ll be willing to do it again on the iPhone if that’s what it takes to retain control.
  • Widespread defection of users and developers to the open jailbreak technologies. This is what got the SDK and the degree of openness we have now. If Apple feels it is going to lose control of the iPhone platform, Apple releases partial control – first the SDK, then lifting the NDA, next… What? How can Apple retain control of the platform and give users and developers Flash or Java?

Apple-Friendly Flash and Java

So, how can Apple retain control of the platform but allow users and developers Flash and/or Java?

Well, they could allow Java as just another language to produce SDK applications sold through the AppStore. AlcheMo translates compiled JavaME applications to C++ code that is then compiled on the SDK. The resulting application can only run on the iPhone after going through Apple’s AppStore vetting process.

Flash? Frankly, the web’s model of flash widgets embedded in web pages isn’t going to fly on the iPhone. It just doesn’t have enough memory to support that use model. Flash Lite? Does anybody think that’s enough? Steve Jobs said there’s a “missing product in the middle.”

How about Adobe Air, letting users run Flash applications on the iPhone “desktop”? Well, if Adobe produces a version that makes these apps standalone, without the ability to download additional code to run, we have the “product in the middle” that Steve indicated could be worthwhile – and that let’s Apple preserve it’s control over the platform.

When users and developers defect to other platforms, and Adobe and Sun deliver versions of Flash and Java that let Apple control the applications delivered to the iPhone, Apple will let it happen.


Comments (2)

So I Want an iPhone SDK Development Book

…but thanks to Apple’s recently lifted NDA, they aren’t available yet. But without the NDA, more should be coming soon.

Here are the ones I’ve found on Amazon (these are my affiliate links):

iPhone Open Application Development: Write Native Applications Using the Open Source Tool Chain, 2nd Edition, by Jonathon Zdziarski. This is the one I pre-ordered. The author was one of the original iPhone jailbreakers. The first edition sold out quickly, so this is the updated follow-up. This is the book to get if you want to be able to exploit the full capability of the iPhone, including APIs that Apple doesn’t document – but if your primary target is the Apple AppStore, you may need to rely on the SDK documents or on another book. Note the First Edition PDF version is still available.
iPhone SDK Development, by Bill Dudney, Chris Adamson, Marcel Molina. The Pragmatic Programmers’ take on the iPhone. I’m really intrigued by this one, too. This appears to be a good comprehensive treatment of SDK development, and coming from the Pragmatic Programmers, it should be quite practically oriented. This book was delayed because of the Apple NDA, but is currently available in beta as a PDF and the source code is also available for use in your projects, but not for training material, books, articles, etc.
iPhone in Action, by Christopher Allen and Shannon Appelcline. The publisher provides Early Access chapters. This book will cover both web and SDK development. Chapter 2 in the early access provides a detailed description of the tradeoffs of web, SDK, and various hybrid development strategies. I’m more inclined to go with a focused SDK book.
iPhone SDK Application Development: Building Applications for the AppStore, by Jonathan Zdziarski. Jonathan Zdziarski comes in from the cold – here’s his book for the AppStore. I expect this book will make a great companion to his Open Application Development book, but it won’t be available until 2/15/2009. I do wonder if Jonathon will run afoul of the SDK agreement’s restriction on circumventing Apple security measures…
The iPhone Developer’s Cookbook: Building Applications with the iPhone SDK, by Erica Sadun. To be released “as soon as Apple lifts the NDA on the iPhone SDK.” We’ll see when it becomes available, as Apple announced they were lifting the NDA (but haven’t posted the new agreement) 10/2/2008. Now available! This book sounds more like a collection of snippets to me, rather than a comprehensive look at the SDK. It also talks about tools to reverse engineer non-SDK frameworks, which could be interesting. Source code for the examples is available.
Beginning iPhone Development: Exploring the iPhone SDK, by Dave Mark, Jeff LaMarche. One of the well-regarded Apress Beginning… series, this will likely be a well-edited, comprehensive book.
iPhone SDK Programming, by M.A. Ali. A 512-page book from John Wiley and Sons, in English. That’s about all we know about it at this point, especially because a search for the ISBN on Wiley and Sons returns nothing.

Comments (1)