Aleksandar • Vacić

iOS bits and pieces

Strange issue with the App Store

In the last larger update (2.5) to my most popular app, Try couch to 5k, I made a serious error during packing and included a wrong data load file for the app. Instead of the 9 weeks running program I included a much simpler 4 weeks program from my other app (Run 2mi).

When I realized this - and realized in horror that there is no way in hell a fix is possible without re-installing the app - I immediately removed the app from sale and submitted a new build for app review. I asked the App Review Board for an expedited review which they granted (many, many thanks for that) and it blazed through review.
I removed it from sale because it affected only new installs/customers, not the existing installations.

Late last night (by CET time) I got the email that 2.5.1 build is ready but is “developer removed from sale”. All fine, I re-selected all the stores and push to sale. It went to “Ready for Sale” and at that time went to sleep.

Issue

So, now you have the context of the story. This morning, about 10h later, I deleted the copy of the app on my main iPhone and went to install it fresh from the app store. Now, in iOS 6 App Store, when you go to a card for an app you already have installed, it shows you Install button. I checked the version in the details below, it was 2.5.1. All good. Tapped Install button and went to home screen waiting for installation to finish. Start the app and…was horrified to see the wrong data again. Deleted the app from the phone, back to App Store app, tap Install again…again the wrong version. I checked the version string that I display inside my app and it was showing 2.5.

At that point I panicked that I again packed the wrong file.

iOS 7

WWDC 2013 keynote was two days ago and I’m still struggling to come to terms with the changes introduced to my beloved mobile OS and, for over a year now, the field where I make my living.

On one hand, I’m extremely impressed with the stuff Apple introduced. There are very important and good API changes that are introduced, things that would help me and fellow developers make much better apps.

On the other hand…visual changes are…appalling, simply shockingly bad. This, from a company universally hailed as masters of making things that create emotional connection. Starting from lock screen, over the app icons and to the way UI controls are done, it’s heartbreaking.

RTFlyoutMenu - drop-down menu component for iOS

I’ve long had a fascination with fly-out or drop-down menus. One of my most successful web components was ADxMenu which I continually developed for years, as things and technologies evolved in web space.

On iOS though, screens were smaller in the beginning and different UI concepts were dominant thus I mostly forgot about this. Until recently, when I had the need to implement a multi-part filtering component for an iPad app I was creating.

So, RTFlyoutMenu was born.

Never save absolute file paths in your iOS app

There’s a mistake I make every 6 months or so and I hope writing a blog post about it will finally engrave it into the back of my mind.

Have you seen how the file paths look like for the files in your iOS app’s little sandbox? Something like this:

1
/var/mobile/Applications/F71BA910-A1F0-4B39-85CB-775806ACFF62/Documents/orders/1832006/1.pdf

The mistake I make is that I take this full URL and then save it into to Core Data storage or wherever (in this case, as order file path). And this will work if you never make updates to the app. However, if you do publish an update to the app, this URL will not be valid anymore.

The gibberish bit in the middle - F71BA910-A1F0-4B39-85CB-775806ACFF62 - is path that is specific to a given app version. So, when you update, your new app version will get some other string in there and all your previously saved / hard-coded URLs will be useless.

What you need to save is only the part that you control and maintain - in my case that’s orders/1832006/1.pdf. Which excludes the Documents part as well as this is automatically created by iOS for your app. Documents is one of several app directories that you can and should fetch using the provided iOS APIs. There is nothing that guaranties that in some future iOS versions Apple won’t rename Documents to something else, so you should not think it’s there to stay.

So, what’s the proper way to read/save local path files?