I know that getting angry at Apple's iOS/Xcode/iTunes dance is nothing new for an iPhone developer, but I just ran into a problem that I thought I would share the 'solution' to.
NOTE: If you Googled this and are looking for a way to downgrade your iPhone while keeping all your data then this is not it.
Now, iOS is Apple's baby, and they are very protective of it. You will upgrade it as soon as possible, and if you think about downgrading it then you are a terrorist who has less right to live on God's green earth than a weasel.
This works fine for 99.9% of people with an iOS device. You plug your phone into iTunes and it installs the new iOS version for you and all is good. But for a developer it's not that simple because if you upgrade your iOS version then you also have to upgrade Xcode. This is a little bit of a problem for me because...
It's a 4.6 GB download! Because I live about 3km from my nearest exchange (and 6km from the CBD of a city with 1.2 million people!?!) my internet speed is crap. So when I sit down to start work for the day I can't really just quickly download Xcode and get to work. I have to put it on overnight, and then I forget to, then I'm back in the same position.
So, simple solution is to not upgrade until you have everything downloaded. Fine.
But, today I hit a problem where I want to restore my iPhone. Restore it to its current iOS version (not the latest). iTunes wont let you do that because it will, by default, restore the phone to the latest version.
But but, there is a trick. If you hold shift and press the Restore button you can choose which firmware version to install.
Magic, thank you apple. There is just one problem with this; iTunes automatically deletes old versions of the firmware, presumably to stop you doing what I'm trying to do.
So Google will helpfully show you the location where iTunes stores the files. On windows 7 it's in
C:\Users\USERNAME\AppData\Roaming\Apple Computer\iTunes\iPhone Software Updates
But you can look in there all you want because if there is a newer version of iOS out there, it will be empty.
Windows 7 is not helping me much here either, because a quick search of my whole system using Windows 7 new super duper 'I'll search but not everywhere and hide the options' method showed no IPSW files. That's the extension by the way, iOS firmware files look like this.
So before I had downloaded the new iOS version, iTunes had helpfully deleted the old firmware, effectively forcing me to upgrate, or preventing me from using the device I own depending on your viewpoint.
But, before I gave up I fired up a DOS prompt and did a proper search of my system.
Lo and behold, there were my IPSW files. Lucky I am slack and never empty my recycle bin. So I went and looked in the recycle bin and there were my files (they actually show up with proper names when you look through the recycle bin). So I restored the one I wanted (iOS 4.3.1) and fired up iTunes...
Which then deleted it again of course. (I think it only deletes it when you hit Restore actually, but whatever...)
So I restored it again, copied it somewhere else then fired up iTunes again.
Then I was finally able to restore my iPhone to its current version. Of course, this wipes everything on the phone, which was fine for me because I'm just using it as a test device and don't care. A while ago I actually tried to downgrade my phone while keeping it's contents and I gave up. I wasn't sure if I would be able to restore my backup of all my contents after restoring the firmware since the backup would be a later version of iOS. I never tried it but I highly suspect it wouldn't work.
Old iOS versions are purged from the earth according to Apple. Wiped from history. You can't even find a link to old iOS firmware files on their website. The files are there of course, there is just no link to them. This site allows your to download old versions, with direct links to the Apple website and yet there is no information on the iOS Developer Center about where to get them.
I understand Apple's motivation for pushing their users to the latest version, but why does it have to be so impossible to do things slightly differently? Will the world come to an end if you downgrade the iOS version?
And we're developers for Pete's sake, sometimes there is a valid reason for having 6 devices all with different versions. I could understand iTunes doing what it's doing if there was a 'Firmware Control Panel' or something in Xcode that allowed us developers to do what we wanted. But there's not.
Crazy stuff Apple.