Working with iOS 8 Handoff Part 2: Using Continuation Streams

Updated on December 23rd, 2014

⏱ Reading Time: 2 mins

In my last tutorial we met for first time the Handoff capability that was introduced in iOS 8.0. With it, an activity that is started in one iOS device can be continued to another from the point that was left off. Also, an activity can be continued on a Mac too, as long as the operating system is the version 10.10 (Yosemite) and a respective application exists. Obviously, it is a nice new feature that developers can take advantage of in order to create cool applications based on an entirely new philosophy.

Through the demo application of the previous post we managed to see the basics of the Handoff: How it’s integrated into an application, how a user activity is defined and how it can be continued to another device. In this tutorial we’ll extend that application and we will learn a bit more advanced techniques which can become handy in several cases. If you haven’t read the previous tutorial regarding Handoff, then I encourage you to read it first so it’s easier for you to follow here. Before you proceed make sure that you’ve perfectly understood what the prerequisites of the Handoff are, and what a user activity is, as it consists of the base of the Handoff and everything else regarding it.

handoff-stream-featured

A user activity object contains various useful properties, such as the user activity type which uniquely identifies an activity, and a user info dictionary, which contains the data that should be handed off. The most important data is transferred with this dictionary from device to device. However it’s not possible to transfer a lot of data to another device using this dictionary, and to be precise, Apple recommends to send data that it’s less than 3KB in size. In most cases this limit is more than enough, but a question arises here: How is it possible to send more data if needed so? The answer lies to the use of streams, which in the case of Handoff are called continuation streams, and this is exactly the topic of this tutorial.

Read the full tutorial on Appcoda

Stay Up To Date

Subscribe to my newsletter and get notifiied instantly when I post something new on SerialCoder.dev.

    We respect your privacy. Unsubscribe at any time.