iOS


The AppStore Ice Cream Truck

Charles Perry (no relation), wrote this follow-up to Brent Simmons’ Love post (app store, indies, etc).

Here’s the question I posted to Charles – Does it change if the ice cream truck is the only one you’re allowed to sell on, yet the entire menu is only the top-sellers?

Sure – don’t blame the delivery truck, but there is significant impact when your product is effectively hidden from view. (How many times have you searched for the exact app title to be presented with dozens of unrelated results?).

Advertising is the obvious answer, and I think that has been the answer for years. I struggle with doing it right. How, where, and how much are all questions I don’t know the answers to. When bootstrapping something and your team is small, it’s a tough sell to spend money on things that may not have a direct correlation to income. BUT how else will people find out about our apps?

We (indies – I count myself as such, though I’m not making a living off it), need to figure this business out. Apple isn’t going to come to our rescue. They’re just the BigBoxRetail of apps. We need to do a better job getting the word out. More traditional advertising channels? Sure. Is there any reasonable way for us as a community to go about educating the average Joe and Jane that AppStore.app isn’t the only (or best) way to find apps? Actually, I wonder if they even care. See my previous post – perhaps the craft and quality movement will creep into digital.

Stay tuned. I hear the ice cream truck coming.

In the meantime a shameless plug: Have you heard about my latest project, Pocket Coach Pro? If you’re interested in getting fit (and I’m not talking about turning into a Hollywood six-pack… just about getting in shape and staying in shape – for your own health), then this app might be the one for you. Go, sign up, and you’ll be on my no-spam mailing list where I will send occasional development updates, take sign ups for beta testing, etc.




Indie Love

Is going indie on iOS viable? Nope. Don’t bother.

First, by Brent Simmons: http://inessential.com/2015/06/30/love

Then, Gruber follows: http://daringfireball.net/linked/2015/06/30/the-love-era

Hit the nail on the head. I have an app currently in development that might have a reasonable chance of doing OK, but I can’t see making my entire living off of it. Sounds great, huh? Here’s the thing – this is a concept I believe in (health), coupled with something I love to do – develop apps that I conceived. To try out-competing megacorp is foolish, but nothing says you can’t have a slice of the pie AND have fun doing it.

One thing I’m reminded of is how I sense parallels to the music industry (or any creative art, for that matter). We do what we do for the love of doing it. Few artists can make a full-time living off the art, but I don’t see that stopping them. Do it because you love it and because some people appreciate it. A few make it big, but not making it shouldn’t matter. That’s where Brent’s most poignant remark comes, “If there’s a way out of despair, it’s in changing our expectations.” True of everything in life, right? It’s often how you respond to circumstances rather than the circumstances you experience that matters.

Let me wonder this – we (Americans, at least) enjoy the big apps from well-known companies. The names sell themselves. Congratulations to them – that’s no easy task. We’re taking another turn. Things like the foodie movement, farm to table, hand-crafted goods, rejection of the mass-produced, etc are surging farther and farther into our society. We have a millennial spirit of idealism that may end up working to our favor. Will “hand-crafted apps” follow? Maybe. I mean, I don’t know if they actually will, but possibly there’s a chance, and I can hope they will.

So, if I may suggest – do it for the love. Any other benefit that comes of it is bonus.




iBeacons In Real Life

The State of iBeacons (June 2015)

This is pretty consistent with my experiences. On observation I’d add  about squirrely RSSI values – readings walk around a bit. You’ll do better to calculate a moving average and toss out the occasional 0 reading. Also be mindful of your iBeacon’s power settings – you may need to calculate your own distance from the RSSI value if the device isn’t transmitting at the default power expected by iOS. Even so, distance may not be entirely accurate. Take it with a grain of salt.




Introducing: Pocket Coach Pro

This project has been near and dear to my heart long before I wrote a single line of code. That said, I think it’s understandable I”m pretty nervous about this pre-announcement. BUT, I also look forward to helping people change their lives for the better. Count this as a semi / unofficial announcement. :)

Several years ago I started getting more serious about my health and began searching for fitness methods that worked. I actually had a lot of trouble finding something that gave me results and was interesting enough to keep doing it. Running wasn’t it. Getting to local hiking spots was too time consuming. Attending the big gym down the road was overwhelming with all those machines (and therefore ineffective). Personal training was way too expensive. What I found wasn’t a set or specific routine or program that gets old after a while (you know those videos you can buy). It also wasn’t a fad celebrity workout.

It took a few years, but things finally started to click. I wanted something that reflected functional fitness to prepare me for “life,” and I needed structure to tell me what I should be doing.  I also wanted a system that was efficient and effective. I’ve been doing this for a few years now, and I can say that it works for a wide range of fitness levels. Most importantly, this system is sustainable for a healthy lifestyle.

Visit Pocket Coach Pro

The app isn’t quite done yet, but we’re getting there. Count this as a first look as we start to get the name out in the wild. Head on over and sign up if you’re at all interested. From time to time I’ll send out sneak peeks, some insider-only info, and I’ll throw in a little bonus for you to make it worth your while. And don’t worry – I don’t do the spam thing. I treat you the way I would also like to be treated – with respect.

I have no set launch date, but it will initially be available for iPhone / iPad, and likely thoughtful integration with Apple Watch.




Automating iOS + Watchkit build numbers, with Git, for iTunes Connect

This wasn’t especially difficult, but it was a little tedious to track down.

I’ve relied on a handy little build phase script (I wish I remember where I found it) for automating build numbers from git commits for iOS apps since Apple gave us access to TestFlight via iTunes Connect. This same script didn’t work for my Apple Watch app as I anticipated, so it took a little bit to work out the kinks for AppStore submission.

It boils down to this

  1. Set the build number = the number of git commits on the branch.
  2. Change the Info.plist build numbers for the iOS app target, the Watch App target, and the Watch Extension target. This is done in a script build phase before the “Copy Bundle Resources” phase.
  3. Reset the Info.plist build numbers after all the build phases have run (another script build phase)

See the gist I posted for the complete script. Make sure to check the directory paths for the correct app name.

Happy building!




Localizing Your iOS App: Tutorial, Tips, and Tricks

I recently ran through the process localizing a client’s app. It took some time to fully wrap my head around the inner workings, but now in hindsight it seems relatively simple.

The general overview looks something like this:

  1. Identify strings that need localization
  2. Generate .strings files
  3. Export & send to translator
  4. Import translations
  5. Some Gotchas [Edit – this is new since this post was first published; I will add to it from time to time.]

If you would like to follow along at home, you can checkout the project on Github.

Pre-flight Check

Before we get going, it’s important to make sure all our ducks are in a row. You need to ensure your project settings file has Base Localization turned on. Go ahead and add a second language, which will kick off a few other operations you’d have to run manually. Among them is adding the en.lproj and the other language’s lproj directory.

Xcode project settings

In most cases, you want to turn on Base localization for your storyboard and xibs. Do this by opening the storyboard or xib, and checking “Base” in the Localization section of the File Inspector. Make sure English and the second language are both checked and the type is Localizable Strings, not Interface Builder Storyboard. This tells the app to use the base localized storyboard for all the layout, and the strings as the language-specific content source.

Interface builder view

You should have something similar to this

Project file list

Identification

The first step is to identify strings that need to be localized. It shouldn’t be hard – anything user-facing should be translated, except for a few words, such as brand and app names (though you can localize the app name if you wish).

Let’s start with some code.

This is a likely scenario – you’re setting text programmatically. The problem is that it’s only going to be in one language. The first step is to use the NSLocalizedString to provide a key name, and a comment used by the translator.

While you can rely on autocomplete to give you a rather verbose NSLocalizedString function, use this tip to take advantage of default values, leaving you with something equivalent to the Objective-C macro. For starters, use your English string as the key:

(We’ll change the key name later). Do this for every string you want translated.

Generate Your Strings

It’s time to run the genstrings command in the terminal – this will take all those NSLocalizedString keys and comments and spit them out in a strings file.

Note: This will only work if you have the en.lproj directory created as part of our Pre Flight. Go ahead and drag the en.lproj/Localizable.strings file into your project. Put it in the Supporting Files group. Open it up. You should see this,

Caution: From this point on, you should not run genstrings on everything – only on new files that haven’t been processed yet. genstrings will overwrite.

Let’s change the key name in the .swift file and the .strings file:

Run the app. Still works. Now, go through your strings and swap out the keys for something not quite so specific. After all, your text could change, so a descriptive key would be helpful.

Now, change the value in the Localizable.strings file and re-run. Great, right!? You can see it’s working just fine – NSLocalizedString is correctly loading the content from the strings file. Time to move on.

Standard translation Changed the translation string.

Storyboards & xibs

Remember the preflight where some things happened, and maybe you didn’t understand it? Let’s look to storyboard in the Project Navigator. Notice that disclosure arrow to the left? Click it. I’m looking at the Main.storyboard (Base), Main.strings (English), and Main.strings (Spanish). Go ahead and click on the Main.strings (English) file.

Yuck!

Unfortunately, your’e kind of stuck with these ugly key names. They refer to the XML IDs in the interface file. If you look at the strings file in my demo project, you’ll also see accessibilityHint and accessibilityLabel values. It’s important that accessibility information (you should have it) be localized for screen readers.

Change one of the normalTitle values and re-run the app.

Pretty neat, huh?

Tip: If you ever need to add new UI elements to the interface file, work on the Base storyboard, then toggle the development language (e.g., English) From Localizable Strings to Interface Builder Storyboard, and back to Strings. The file will be re-generated. (You’ll be asked to confirm you want to do the conversion at both points).

Tip: Don’t bother trying to change the comments, either, unless you absolutely know you’re done tweaking the interface. It is more helpful to provide translators with screenshots if they are kind enough to take them. Context goes a long way.

Caution: There’s one problem you will run into – UITextViews. For some reason, as of iOS 8.1, an iOS bug prevents UITextView text values from updating. You’ll have to set it separately via NSLocalizedString. It’s a pain.

Export

Time for export. Xcode 6 introduces xliff file support – something that I understand is an industry standard in the translation community. To begin, select the top-level project in the Project Navigator, then go to the Editor menu > Export for localization…

In the dialogue that follows, select “Development Language Only”.

Save the file anywhere (I like to keep it versioned in the project root… on the filesystem, not in the actual Xcode project). I usually give it a name like “Translation Files”. It might take a few moments to process.

When you’re done, you’ll have a handy file called en.xliff (if English is your dev language). This is what you send off to the translator.

Import

The import process is easy. Select the project, then go to Editor > Import Localizations… . Xcode will do the rest.

Testing

Besides testing in your development language, make sure all the strings are displayed properly. You can even do this before a single word has been translated. Try running the app with pseudo localization. Open the scheme settings (Product > Scheme > Edit Scheme), select the Run group, and then click on the Options tab.

Check Localization Debugging (will show non-localized strings in all-caps).

Application Language – I often use Double Length pseudo language.  It makes all your strings twice as long. Sometimes you’ll see some funny formatting, especially if you have string substitutions (e.g. stringWithFormat) as part of your values. That’s ok – it’ll still work.

You can also export your xliff to an online service that will provide you with automatically generated pseudo languages you can try in the app. It’s funky looking, but it gets the job done. They’ll provide you with the appropriate instructions for their service.


Some Gotchas

NSLocalizedString with table

I didn’t catch this at first on a recent project. It’s subtle, yet frustrating to diagnose.

When using NSLocalizedString, and you reference a table, the translation export procedure will create an entry in the xliff file for the tableName.strings, which means on import, the appropriate .strings file will be generated. It’s worth noting.

Look for tableGenerationExample() in the demo ViewController, then look in the en.xliff export file. Scroll down until you find this section,

Look familiar?




iOS TDD (Test Driven Development) – Convincing Myself

By no means is TDD (Test Driven Development) a new concept; I’ve known about it for years. I had sone some unit testing on projects prior, they became an integral part of routine when I started consulting for HP’s Software R&D lab. We’ve been very good about testing out all the important logic of the application, save automated functional testing of the UI (more on that in another post).

This post is really about TDD, not convincing you to unit test your code (something you should be doing). Actually, I’m not a diehard TDD fanatic. Rather I use principles of testing first before writing application logic. I don’t want to get stuck the pedantics of true TDD development.

My journey, if you will, started as I had a turning point in two projects for Pivotal Action that convinced me. The first project involved a bit of interplay between iBeacons (CLBeacon) and networking, which would be impractical to manually test with physical hardware. The second project involves a lot of transformations being applied to objects, and some networking. In both cases, relying on rather extensive unit tests could ensure I wasn’t breaking functionality with new features.

My general approach involves a few simple practices:

  1. Create a mock data set for input. I often use JSON files because it’s easily readable, and you can use the same data on multiple tests if you need. Also helpful if you’re testing mock network response data
  2. Create a test data set, or scenario. First pass, go with the “golden path” – the best case scenario
  3. Determine what your desired outcomes are in a best-case scenario
  4. Create separate test cases for each kind of data you may have to deal with. Again – start with the best case scenario
  5. Write some logic code to either transform data, or respond to it
  6. Go back to step 1 and create a new set of data representing one type of problem, or family of very similar problems. This could be malformed data, error codes from API services, etc. as well as common problems : out-of-bounds errors, off by one, nil, and others.
  7. Keep repeating 2-5 until you’ve exhausted just about every scenario you can reasonably think of.

This may seem boring and repetitive, but I assure you that thoroughly testing your logic will uncover holes in your implementation before you even start writing application and UI code. You’re also more likely to survive refactoring unscathed if you have extensive unit tests covering the changing code. I recently benefitted from this when I converted a set of model classes over to a CoreData stack. It wasn’t a perfect 1:1 refactor, but it uncovered some places where I had to adapt my expectations and logic so that the transformations would be the same in the end.

I’m not perfect at this, but I can say that doing unit testing before really getting into the guts of an application has saved me a lot of work farther down the road. I also have more confidence that changes I make aren’t breaking existing functionality. Give it a shot.




July 2014: We Noticed Indie Died

It seems July 2014 may go down as the month when we realized being an indie (iOS) developer is no longer feasible. It’s not that something suddenly happened, rather, we collectively realized the same thing: there’s no way to make a living doing this.  Rather than making a living off of developing one or two apps, we need to find another source of income and do this on the side. It’s the only way.

Here are some recent posts by notable developers in the community. They hit on a few different woes, and points. Some implore we approach this whole thing from another direction.

 

A Candid Look at Unread’s First Year

More on iOS Indies

Shopster 2013

iOS Indie Game Numbers

App Rot

Organization

The iOS Indie That Could

Trials and Updates are Still Dead

On Pricing More

App Store Realities

Why I Left Indie Development

Where are the Indie iOS Developers You Ask?

The Mobile Software Disaster

Another Non-Indie Developer App Story

The New Indie

 

I fall right in line with many of the experiences expressed in the aforementioned links. In the early days of Pivotal Action, we were starry-eyed at the possibility of creating something great that people liked, with the “reasonable” hopes of being successful. We started off with Completion, and later went on to work on a new project, Pixd, that never shipped (though it was close-ish). By the time we more or less gave up on Pixd, I think we had realized the return on our time investment was unlikely to pay off. Even as the dust was still settling with Completion, we knew we couldn’t quit the consulting side of the business – it was paying the bills.

[UPDATE] I’ve added additional links showing more experiences and perspective on the indie situation




MapBox Visualizes 3 Billion Tweets

Visualizing 3 Billion Tweets 

The patterns of usage in each city often reflect economic stratification. For example iPhones, in red, are predominantly in wealthy sections of the city while Android phones, in green, have more coverage in poorer sections. On a global level, national trends reveal a complicated set of cultural preferences.

I wouldn’t say this is surprising – simply another data point demonstrating what we already know… iPhone owners have more disposable income. It explains how the iOS is more profitable as a platform than Android.




Raising the Bar on Real

Apple Outsider » Real.

We don’t need the deception of “photorealism” anymore. Despite the loss of these tricks, iOS 7 feels more real. The parallax effect conveys an entire living world under that glass, not just abstract pictures and icons.

On the surface, iOS 7 looks like a refreshed UI, and nothing more. But digging deeper and looking closer, we have entirely new channels of user experience and interaction design opened up to us – not because we can (we always could) – but because it’s the new status quo. The bar has been raised.