Search
Twitter Feed
Navigation

Entries in Xcode (2)

Tuesday
Apr192011

iOS versioning: iTunes made me an offer I couldn't refuse

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.

iPhone2,1_4.3.1_8G4_Restore.ipsw

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.

 

Thursday
Apr072011

Major update to Spartan Athletics approved

After a bit of a marathon effort, version 1.1 of Spartan Athletics is now available in the app store.

Now, I'm just the coder for this project, but if I was the owner I'd have called it version 2.0 at least, because a lot has changed since the original version.

It now has all ten events available, as well as bluetooth multiplayer support and a whole heap of improvements and bug fixes.

But getting it approved was not easy. A while ago I updated my 3GS to iOS 4.3 without thinking, and of course that meant that I had to update XCode to 4.0 to be able to build to device. Only then did I realise that perhaps this wasn't the smartest move after looking at the growing number of threads about the problems people were having.

One major problem was that the plug-in I used for bluetooth was definitely not compatible with Xcode 4.0. I used Prime31's 'GameKit Bluetooth/WiFi and Voice Chat' plugin. That runs some magic little scripts when you build in Unity to set up the Xcode project and they were broken. But, due to the awesomeness of Mr Prime31's service, after a quick message on twitter I was sent a beta of a 4.0 compatible version of the plugin.

So all seemed good, and the plethora of ad-hoc builds I'd done using Xcode 4.0 all worked fine, on iOS from 4.2.1 to 4.3.1 and iPod touch, iPad and iPhone. So we submit it to Apple and pretty soon get a rejection letter.

We found that your app failed to launch on iPhone 4 running iOS 4.3.1.

We encountered the issue when selecting the application on the Home screen - the app displayed a launch image then quit unexpectedly. This may be because iOS 4 uses a watchdog timer for applications; if an application takes too long to complete its initial startup, the operating system terminates the application. 

For information about the watchdog timer, please see 
Technical Q&A: Application does not crash when launched from debugger but crashes when launched by user..

Another possibility could be a missing entitlement. For more information, please see the 
Technical Note: Resolving "0x800003A", applications not launching and "missing entitlement".

For discrete code-level questions, you may wish to consult with 
Apple Developer Technical Support. Depending on your questions, be sure to include any symbolicated crash logs, screenshots, or steps to reproduce the issues you’ve encountered.

To appeal this review, please submit a request to the 
App Review Board

I had no idea what was wrong, and the documents that Apple linked to were not very helpful. But, I figured that maybe I had messed up in the signing process and used the wrong distribution profile or something. So I re-did it carefully and tried again. Nup, still rejected.

Then we finally found this thread on the Unity forums. Luckily I still had the Xcode 3.2 installer. So I installed that and re-build in Unity with the target SDK set to 4.2 and re-submitted.

Success.

Bloody hell Apple, you sure don't make it easy for us developers. Between the provisioning profile clusterf*ck, the insanely diffucult iOS downgrade process and the almost five gig Xcode downloads for even miniscule version updates, the world of Android development is looking better and better. 

But you're still where the money is... and that's why we love you.