High time I've updated Frosties!
Written by miechu   
Wednesday, 13 November 2013 20:10

I've got a shameful secret to share.. Frosties is crashing. What's worse, it has been crashing for quite a while now. Since iOS 5 was introduced. Yep, it's a long time. And there's a 100% repro. It's a big scratch on programmer's honor, so I had to fix it. And I did, two days ago (high freaking time!).

Now due to the long time during which Frosties had not been updated there was a number of thing that had to be done

  1. application had to be updated to take full advantage of "new" iPhone 5 resolution
  2. all middleware had to be updated to make sure everything works as expected on latest system (iOS7)
  3. update all the code that has been using functions/functionality deprecated since iOS4.2 (last Frosties version)
  4. and then see what happens!

1. iPhone5 compatibility

At first I had no idea how to enable Frosties to use whole iPhone5's screen. Being an experienced developer I quickly resorted to the ultimate knowledge source: Internetz! After a short while I've found this article. It turns out all one has to do is to supply app with appropriately sized splash screen. Cool.

I had some not visible margins in background images so this worked out of the box after increasing resolution. What I was surprised by the most was that all other GUI elements (all buttons and labels) were placed as expected! Well, maybe not surprised, rather pleasantly assured that I know my stuff. When developing Frosties I was placing all GUI elements relative to relevant logical screen points, like "left upper corner" or "center". This paid off and UI looks right out of the box. Good coding practices FTW!

2. Update middleware

Both ads providers I'm using, iAd and AdMob, required update of my code due to multiple functions gone deprecated. This was piece of cake. However I've noticed strange, unexpected banner sizes, not matching current device orientation. I'm unable to tell what was the root cause because I was (thankfully!) able to fix this by tossing programmer's-intuition based fixed before I had to dig too deep into this issue. Phew.

One other middleware Frosties is using is Localytics, which had do be updated since old version was using UUID, and Apple restricted usage of these (in iOS6 as far as I remember). While visiting Localytics' site I had a look at recent data, and it seems there's at least 20 people still playing the game! That's a nice feeling.

3. Replace deprecated function calls

Yeah, did that ;)

4. See what's left

Well, after all above it was far from ideal. Here's why:

  • Rotation broken! The game just ceased to respond to device rotation changes. After some googling (stackoverflow.com is priceless!) I've found out that navigation controllers no longer pass rotation state notifies and queries to root controller. Starckoverflow's answers were saying something like "subclass UINavigationController and handle it there". Gibberish! I have only view controller, how am I supposed to subclass from totally unrelated class?!? But of course I knew they were right, and I suck at Apple's MVC, so I started digging and this article helped me to connect the dots. All I had to do is to subclass UINavigationController (just like they said) and explicitly create its instance and plug it into main app's window (which they didn't say).
  • I've noticed some Game Center issues but since I remembered that not many people played online PvP I considered removing it completely. I had another look at my Localytics data and it turned out that during past year there were only 9 online PvP games. In such cases I tend to thing these were triggered out of pure curiosity or even accident. Screw it, not worth the effort. I've removed online PvP. The "hot seat" PvP (the very popular one) stays.
  • When I started preparing Frosties' new version for upload Apple gently reminded me (by not allowing me to save changes) that I not only need to supply screenshots for "new" iPhone5 resolution, but also that my old iPhone screenshots are no longer valid since there's no longer a 320x480px screen iPhone. Apple supported regular-shaped iPhones are all Retina now. Fancy! Had to prepare new one both for iPhone4 and iPhone5 device families. Luckily being a programmer that rarely throws stuff out I had my source PSDs stored and I was able to reuse them without much hassle! Asset hoarding rulez!

Ready to submit

After a couple of test runs with TestFlight I was happy enough with the state of the game that I've decided to submit it to AppStore... Easier said than done :/

First app bundle validation attempt simply failed because it was requiring ARMv7 without saying so in bundle's config (Info.plist file). Adding "require ARMv7" to app's requirements didn't help since now validation failed due to app requiring device capabilities it didn't require in previous versions. Bummer. Adding ARMv6 to supported architectures in Build Setting didn't help neither. Damn! Googling to save the day and it turns out it's enough to set iOS Deployment Target to at least iOS 4.3 to solve the issue.

At this point bundle validation reported only missing app icon sized, as warnings, so I didn't care much thinking scaled versions will look ok enough.

Was I surprised when my submission attempt failed! Of course I initially thought Apple doesn't accept bundles that have even warning, so I went through the pain of transitioning my app's icons into an "asset catalog". Well, it was in fact rather painless (all one has to do is to change settings in General settings of the project and a catalog will get generated for him) but pointless. After supplying all possible icon sizes and passing bundle validation without a single warning it still would not submit throwing a mysterious "An error occurred uploading to the iTunes store"" message. Gee, thanks, that explains everything!

Uncle Google however was more informative and I've quickly found threads on starckoverflow that claimed it was related to Java version I'm using. Damn you Java! Downgrading to Java 1.6 helped and I was able to successfully submit my binary to the AppStore. Yay!

Within an hour I've received info from iTunes that my app is using restricted functionality, namely UUID. Well, technically I was some old CocosLive code I'm not really calling at all, but it was in my binary so Apple had all the right to fail my bin. No worries, a quick fix and resubmission.

Summary

Frosties 1.5 is currently awaiting review and I think it should be fine. Lessons learned from all of this: don't let your code rot for two years, unless you're never going to use it again. Ever. Can you ever be sure?

Take care!

 
Comments (1)
1 Friday, 29 November 2013 22:34
Tony
Good stuff man!

Add your comment

Your name:
Comment: