The Top 3 SDK Integration Mistakes iOS App Developers Make

Michael Z
Cloud Middleman
Published in
4 min readMar 1, 2017

--

You know that feeling of starting a new Xcode project? How good a clean slate feels? File -> New -> Project! For one brief moment the most complex decision you have to make is to choose a name!

For those few short minutes before you start writing code, the possibilities feel endless and you know that the little world you’re about to create will never be so clean, organized, and manageable as it is right now. As much as we love writing code, we intuitively know that with each line added, we’re introducing complexity or a possible point of failure into our apps.

Soon the shine of a new project wears off as our file counts increase. We begin to realize we need an SDK for networking (because who wants to deal directly with URLSession), one for Analytics (thanks Marketing!), and perhaps a dozen other third party SDKs. The average iOS game has 17 SDKs! Nothing makes your new project feel old and heavy as introducing a bunch of third party dependencies into your clean little world.

We’ve all had SDK fatigue. In any modern application with normal business needs it’s unavoidable.

As our Podfile grows, it becomes easy to make simple mistakes when introducing a new dependency. With so much poorly written documentation out there, it’s tempting to just wing it.

Inevitably, there are a few common mistakes that almost every iOS developer has made at least once when integrating a new SDK into their project…

Failing to Initialize the SDK

Every vendor based SDK that interacts with a web service must be initialized early in the apps lifecycle. Normally, in our AppDelegate file, we place a few lines of code in application(_:didFinishLaunchingWithOptions:). As the number of SDKs increases we’ll probably isolate initialization code into it’s own function.

When we start dealing with a dozen or more SDKs on a project with multiple developers, it’s easy to forget to initialize the SDK and scratch our heads when our analytics code deeper in the app doesn’t seem to be sending events to our analytics service. I’ve seen developers spend hours trying to troubleshoot this very scenario when all they needed to do was initialize the SDK in the AppDelegate with one line of code. Don’t be that guy or girl!!

Forgetting to Insert The Proper Credentials

Although slightly less common than forgetting to initialize the SDK altogether, this fun little mistake has caused many a headache. Does this sort of documentation look familiar:

We’re often in such a rush, that we simply copy & paste boilerplate code into our projects then quickly move on to the more juicy stuff. Then later, when things don’t work you feel like swearing at your vendors, writing angry support tickets, or just wish Marketing would leave you alone…”Do we really need attribution anyways?” you say to yourself as the pressure in your head grows and your dev machine stares menacingly back at you. You take a break, maybe go for a coffee or a walk, and then later with fresh eyes, your mistake becomes embarrassingly clear. The moment you realize your sdkSecret isn’t actually “YOUR_SDK_SECRET”, is not only humbling but you look over your shoulder to see if anyone else has witnessed this rookie failure even though there’s no one else in the room.

Forgetting to Import the Library

Thankfully, this last mistake isn’t as frustrating or difficult to catch quickly but it’s no less common. More than we’d like to admit, we depend on Xcode’s autocomplete feature, especially when working with unfamiliar frameworks or libraries. You start typing “AKAccount” but aren’t seeing Xcode autocomplete the class name. You’re so sure that Facebook’s account kit class is “AKAccountKit”. Dammit. You head over to Facebook’s account kit documentation to prove yourself right. Oh, it’s “AKFAccountKit”. No sweat. You start typing again and still Xcode offers no help. Ugh. Then it hits you. You forgot to “import AccountKit” at the top of your current file.

Working with SDKs doesn’t have to be frustrating. Even though there is a bit of an ugly feeling as we introduce so many into our apps, at the same time it can be quite fun discovering new functionality and working with new libraries. While these mistakes aren’t serious, they are common and can make our days just slightly miserable. If you find yourself making them more often than you’d care to admit, build yourself a little SDK integration checklist to help you each time.

--

--