Aleksandar • Vacić

iOS bits and pieces

Real-time inter-app communication

Or more like “real-time”, (near)real-time or whatever modifier you prefer.

App Extensions are the new shiny in iOS 8 and one that interest me the most, especially in the fitness area. Here’s why: I use my iPhone as the core device of my entire business hence I have lots of sensitive personal and business data on it. Thus it’s natural that I have all possible security features turned on. Passcode is set, TouchID is on, instant lock with no grace period etc.

This presents an issue when I go out to run with my iPhone. I don’t usually run with an armband (only in races) thus the iPhone is usually in my pocket. From time to time tough, I would like to check the parameters - heart rate, distance, pace etc. In reality, this means that I should:

  • dug it out from the pocket
  • unlock – Touch ID is not always reliable with sweaty fingers (at least on 5s), so it means type out the passcode
  • back into the pocket

Step no. 2 is what bugs me and where extensions come into play. If I have to slide to the left for the passcode screen, then I might as well slide from the top and get the info I need from the Today widget.

That’s the thought process that ended with: iOS 8 version of Run 5k will have Today widget that’s (more or less) a replica of its running view.

The only problem to solve is - how to communicate app status between the main app and the widget, in real time?

Putting Sensor Tower to work

I have spent a lot of time in the last month or so working on Banca, updating it for iOS 8 and new iPhones. Thus I wanted to make sure I did anything I could to get people to at least check it out. One aspect of that is better placement of the app in the most important searches. Banca is currency converter app, a field that’s very crowded with many free apps. Thus competing as paid app in there (IAP really makes no sense for an app like this) is challenging, to put it mildly.

Thing is, how exactly to do this? It’s not like every app developer goes and post his keywords, so you can see what the best ranked ones are using. After quite a lot recommendations from friends, online and offline, I went to check Sensor Tower. Among many other services, they prominently feature keyword research, suggestions, tracking, even translations.

Right on their homepage you have an option to guess the keywords of any app. I picked Banca and was floored with the result.
They returned almost every good keyword, even the more obscure terms I used. Wow; talk about a good start.

Allow landscape, only on iPhone 6 or 6 Plus

I sort of already solved this - how to allow certain orientation per view controller, late last year while (surprise!) working on the very same app I’m updating now: Banca currency converter.

However, this is a bit different. iOS 8 brings size classes, deprecates old orientation callbacks and in general tries to move away from dealing with fixed numbers.

Oki, what’s the deal here; iPhone 6 Plus has a system-wide support for operating in landscape mode, including home screen arrangement with the dock on the side. Thus it’s more than expected that our apps should work in landscape on iPhone 6 Plus. Gone are the days when you could get away with just Portrait, since that is the natural way to hold the iPhone (for all but video and games).

Phantom spaces in UILabel's text

Yesterday, I posted an article about how I apparently found a bug in NSAttributedString, happening only on device. I was wrong. There’s no bug, only me being tired (I posted that article at 4am) and not looking for source of the issue hard enough. Here’s what really happened.

While working on Today extension for Banca, I encountered an issue that killed me at least a day or so of productivity. I have a table cell that looks like this:

Right-hand labels have NSTextAlignmentRight set on them and it worked fairly well during inital spec-ing of the cell and even during entire development in the Simulator. It went downhill as I moved to my iPhone.