Wednesday, July 23, 2008

iPhone SDK Beta 2 PPC Fix

So Apple released the second beta of their iPhone SDK today...

I work on PowerPC Macs because I haven't felt the need to plunk down a couple thousand dollars for another computer when my Powerbook still works perfectly fine. I did, however, purchase an iPhone, and I'd really like to develop applications for it. Considering the fact that I paid almost $600 (after activation, etc) for the thing, and I previously dropped $2500 for the PowerBook, I feel that Apple owes me something for the money spent.

The previous version of the iPhone SDK didn't install the Aspen platform packages on PPC, but you could still manually install those packages and compile for the simulator with a simple warning about your unsupported (ppc) platform. Apple changed that with the second beta. First, the Aspen packages have now been prefixed with 'iPhone'... No big deal. Second, they've unfortunately made it a compilation error to attempt to compile for the iPhone simulator using a PPC computer. I find this unacceptable and I’d like to pay bills rather than buy new computers, so here’s what I did:

· Once you've moved the iPhone platform directories to their appropriate location under /Developer/Platforms, drill into: /Developer/Platforms/iPhoneSimulator.platform/Developer/

· In this directory, you will find a file called "iPhone Simulator Architectures.xcspec" Make a backup of it and open the original in your favorite editor

· You'll notice in this file that the 'RealArchitectures' variable only defines i386 as a valid architecture. I change that to "(i386, ppc)"

· What I did next was essentially steal some of the definitions from the Mac OS X Architectures.xcspec file and added them to the end of the file.

The end result can be found here and can be used as a drop-in replacement of your "iPhone Simulator Architectures.xcspec". Make sure you back up the original though, or be prepared to reinstall.

After changing the file and relaunching XCode, my iPhone Simulator builds run fine... Not even the original warning. Wonderful!