I have an iPhone. I also use Google Mail as my web-based mail client. Unfortunately, there is really no good way to get push Gmail on an iPhone. Even now, post firmware 3.0, these are the best ways:
- Pay for a service like MobileMe.
Problem: service fees seem like overkill, and the push E-mail would be the only benefit I’d get from it. - Wrap Gmail’s IMAP service in an exchange server. There are some paid services that do this, however, Z-Push is free (if one can host it one’s self).
Problem: the iPhone only supports a single Exchange server at a time. Therefore, I’d have to choose between getting push E-mail versus over-the-air calendar/contacts synchronization that is currently provided through Google’s own “Sync” Exchange wrapper. - Write an app that uses the new Push Notification service in firmware 3.0 to remotely push mail to the phone.
Problem: this would probably be a very lucrative solution (i.e., I’ll bet lots of people would pay a nominal one-time fee for this app), but it would almost definitely be rejected from the App Store. Furthermore, it would require me to set up a back-end server running 24/7 to push the updates. - Jailbreak the phone and write a daemon that runs in the background, connects to Google’s IMAP service, and goes into IDLE mode.
Problem: the only Apple device I own is my iPhone; how might I compile my own apps for it? (Sure, my wife does have a PowerBook, but that would be cheating, right? Right‽)
- Compile native apps (both console and Cocoa/Springboard/GUI) for the Apple iPhone.
- Utilize API features up to version 2.2.
- Do both of the above on Linux/BSD (probably also including—but not personally tested—on OSX and from Cygwin).
- Use API 3.0 features (AFAIK), however, the binaries created by the toolchain can run on iPhones running firmware 3.0 just fine.
- Submit apps to the App Store.
- Simulate the iPhone on your desktop (like XCode’s simulator).
- Install binaries to a non-jailbroken phone (AFAIK).
- You must have a subversion client installed.
- You must have a non-ancient version of Java installed.
- You need the xar and cpio utilities.
- You obviously need all of the dependencies required to compile the gcc cross-compiler (none of which I know offhand).
- Command line skillz.
$ mkdir -p ~/projects/iphone/ $ cd ~/projects/iphone/toolchain $ svn checkout http://iphonedevonlinux.googlecode.com/svn/trunk/ ./Modify
IPHONE_WIKI_KEY_URL in toolchain.sh (around line 96) to be the following:
http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.xand then run
$ chmod u+x toolchain.sh $ mkdir -p files/firmware $ mkdir -p sdksDownload the latest iPhone SDK from here (you need to have an apple developer account, which is free). This should end up being a
.dmg file. You need to get two .sdk files out of this .dmg. The toolchain.sh file has code to do this for you, but I couldn’t get it to work. Therefore, I used a free tool called hfsexplorer; download it here. It doesn’t claim to work in Linux, but it turns out that it was written in Java so in actuality it works fine. Just download the .zip version, go into the ./lib/ directory and run
$ java -jar hfsx.jarA GUI will pop up. Open the iPhone SDK
.dmg file and locate MacOSX10.5.pkg (or whatever is the latest version) in the Packages directory; extract it to the sdks subdirectory in your toolchain directory. Rename it to macosx.pkg. Also in the Packages directory, there should be a .pkg for the latest iPhone SDK. I forget what it was called, but it should be obvious (famous last words). Also extract that file to the sdks directory and rename it to iphone.pkg.
$ cd ~/projects/iphone/toolchain/sdks $ xar -xf iphone.pkg Payload $ cat Payload | zcat | cpio -id $ mv -f mv -f Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk . $ xar -xf macosx.pkg Payload $ cat Payload | zcat | cpio -id $ mv -f SDKs/MacOSX10.*.sdk .Now you should have two
.sdk files in the sdks dir. You can delete all other files in that directory; you don’t need them anymore.
$ cd ~/projects/iphone/toolchain/files/firmwareDownload the
.ipsw file for the 2.2.1 firmware into this directory (I haven’t yet tried this with the 3.0 firmware). You can find the .ipsw file stored within the file structure of iTunes’ Application Support directory, if you’ve ever used that version of iTunes to upgrade your iPhone to that firmware. If you don’t have it, it’s widely available online (just make sure to check the hash after you download).
Now we’re ready for the big step: compiling the toolchain!
$ cd ~/projects/iphone/toolchain/ $ ./toolchain.sh headers $ ./toolchain.sh firmware $ ./toolchain.sh darwin_sources $ ./toolchain.sh buildNow you can optionally remove some temporary files:
$ ./toolchain.sh cleanYou can test the toolchain by following the instructions here in the section of that same name, here. Good luck!