Facebook and Twitter have released SDKs for Apple tvOS to provide support for onboarding, user verification, and analytics.
Onboarding and User verification
Onboarding for the Apple TV is one of the biggest challenges when developing apps for tvOS. Chris Oryschak, Product Manager at Twitter, described the user experience of traditional login and verification on tvOS as cumbersome. Furthermore, he goes on, many developers have reported that logging into the Apple TV is hard for end users. This comes down to two factors: lack of support for login methods that support oAuth, and tvOS non-standard input style, which makes it hard to use the traditional username/password method.
To fix this, both Twitter’s Digits SDK and Facebook’s Login enable a two-factor authentication mechanism: when verification is required, tvOS will show a short alphanumeric code that the user will have to enter respectively on http://digits.com/appletv or http://facebook.com/devices via their laptop, tablet, or phone. This will immediately open a session on the Apple TV.
To that aim, both SDKs provide a view controller class that will handle the whole process and call a delegate method when the verification succeeds:
// Twitter's Digits:
func didTapButton(sender: AnyObject) {
let viewController = DGTAssistedAuthViewController(appearance: nil) { session, error in
// This is a completion block
}
presentViewController(viewController, animated: true, completion: nil)
}
// Facebook's Login:
FBSDKDeviceLoginViewController *viewController = [[FBSDKDeviceLoginViewController alloc] init];
viewController.permissions = @[@"publish_actions"];
viewController.delegate = self;
[self presentViewController:viewController animated:YES completion:NULL];
Analytics
Facebook’s Analytics provides a way to log events similar to Facebook’s Events iOS SDK. All that is required is calling:
import FBSDKCoreKit
FBSDKAppEvents.activateApp()
Once your app is activated, you can log any of a set of predifined events, such as app launched, completed registration, or a wholly custom event. No login is required for this to work.
Twitter’s Crashlytics takes a different approach in that it will almost immediately report any crashes that your app experiences, complete with crash log and summarized view of how each crash affect your app’s installed base.
Facebook’s Share
Facebook’s tvOS SDK also provide a FBSDKShareAPI
class that will make it easier to share any content to Facebook.
Twitter’s Digits and Crashlytics are part of Fabric, available on GitHub. Facebook’s Login, Analytics, and Share can be downloaded from Facebook’s web site.