Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Audit Those Version Checks!

DZone's Guide to

Audit Those Version Checks!

Remember the gales of laughter we all had at those silly Windows programmers when they had to skip Windows 9 because of Windows 95 version checks? Well, apparently there’s a good number of us that aren’t any smarter than Windows programmers...

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

Here’s an extra-special class of problem to watch out for in your iOS 10 testing: Brain-dead version checking. Remember the gales of laughter we all had at those silly, silly Windows programmers when they had to skip Windows 9 because of Windows 95 version checks? Well, this is pretty embarrassing, but apparently there’s a good number of us that aren’t any smarter than Windows programmers:

That’s just painful. But there can’t be that many instances of that out there, right? Right? Let’s check this fine article:

Efficient iOS Version Checking

A GitHub search shows that there are over 8000 results calling substringToIndex:1. All of that code will break with iOS 10. It will instead assume iOS 1, where the only apps that existed were jailbreak apps.

Oh, dear. Well, we know that of course you personally, Dear Reader, would never do anything like that … but we very strongly indeed suggest that you do as full an audit as possible of any codebase you expect to be running on iOS 10 to make sure the Evil Code Elves didn’t sneak anything like that in behind your back.

Read the article for more discussion than you probably need of various ways to address this problem. We say “probably” because you’re all programming in Swift now, aren’t you? so you can just use Swift’s #available operator if you really need to check a specific System version. If you’re not, hey the article dives into its implementation, so copy what you need!

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:
github ,ios ,version

Published at DZone with permission of Alex Curylo. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}