As an iOS Developer I thought it would be interesting to try to add Snapchat’s Snapkit features to an app I have under development.
Snapchat is playing catch-up in a race to keep its platform relevant and wants software developers to embrace its tools. Facebook and Twitter have long had development kits available for apps such that logging in to an app with Facebook and Twitter is commonplace. And posting to both is built in to probably thousands of apps.
After just scratching the surface of the offerings, I am not impressed with Snapchat’s documentation nor support.
These are the very first lines of the iOS API Reference
This documentation assumes you already made contact with us. The Snap Kit developer portal is the place for adding your application, exchanging keys, and getting set up with the proper API credentials.
It is not at all clear to me how or why one would “make contact” with Snapchat. I suspect this document is out of date and that it was written when Snapchat was working with partners. As far as I can tell, the API is now completely open to anyone interested. So I’m either wrong and need to contact Snapchat (How?) or this very first paragraph is utterly misleading and out of date.
Next up I thought I would integrate Snapchat login. My app already has authentication via Google, Twitter and Facebook (do you see that Snapchat… you need to blow me away just to enter the game)
- SCSDKRedirectUrl (string): The URL that will handle and complete login requests; must be a valid URL in the form foo://bar—without bar, redirects will fail
I’m sorry, what? What URL will complete and handle the login? And what does “foo://bar” without the bar mean? And if it means what I think it does — why would you write something like that? (I think it means .. ‘someurl://’)
I guess as a developer I’m supposed to know what the URL syntax should look like. But wait, Snapchat has a few GitHub repositories with examples.
But wait, only one of the examples is written in Swift (remember I’m developing for iOS).
Since I like to try to solve my own problems, I thought perhaps the sample app would shed some light on the mysteries of SCSDKRedirectURL. This URL is supposed to go into the info.plist. Let’s see what the example app from Snapchat has in the info.plist
<dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string><!-- Insert your redirect url scheme here --> </string> </array> </dict>
Fantastic, that clears things right up.
As I was already in GitHub and already looking at the sample app supplied by Snapchat, I thought I’d file this lack of clarity as a bug against the sample repo. It’s issue #3 Redirect URL—Clarity in documentation please
Someone named David cleared things up in response to the bug. He says
So if you registered my-app://auth/snap then you would have this entry in your Info.plist:
<key>SCSDKRedirectUrl</key> <string>my-app://auth/snap</string> as well as: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>my-app</string> </array> </dict> </array>
As a side note, Snapchat support has no idea how to handle Snapkit requests. I can’t stop giggling when I read the response when I ask if they are the right folks to get help from.. “We’ll need to look further into this”