Implementing Handoff Between iOS Devices

BLACKSPARC.TECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1735 services
Implementing Handoff Between iOS Devices
Medium
~2-3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    792
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    671
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1097
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    969
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    914
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    495

Handoff Implementation Between iOS Devices

Handoff allows you to start a task on one Apple device and continue on another—text in Notes, a page in Safari, a screen in your application. The application icon appears in the Dock on Mac or in App Switcher on another iPhone/iPad. The user taps—your application opens in the same state.

It works through Bluetooth LE (device discovery) + iCloud (payload transfer). Both devices must be signed in with the same Apple ID.

NSUserActivity — The Only API

Handoff is built on NSUserActivity. The same class used for Spotlight and Siri Shortcuts—this is intentional, Apple's unified Activity architecture.

// On the sending device
let activity = NSUserActivity(activityType: "com.yourapp.editDocument")
activity.title = document.title
activity.isEligibleForHandoff = true
activity.userInfo = ["documentId": document.id, "scrollPosition": scrollOffset]
activity.needsSave = true // requests userActivityWillSave before transfer
self.userActivity = activity
activity.becomeCurrent()

activityType is a string from the NSUserActivityTypes array in Info.plist. If the type is not registered—Handoff doesn't work.

needsSave = true and userActivityWillSave. If state changes in real time (scroll position, entered text), don't update userInfo on every change—it's expensive. Set needsSave = true, the system calls userActivityWillSave(_ activity:) before sending. Update userInfo there.

Receiving on Another Device

// AppDelegate or SceneDelegate
func application(_ application: UIApplication,
                 continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    guard userActivity.activityType == "com.yourapp.editDocument",
          let documentId = userActivity.userInfo?["documentId"] as? String else {
        return false
    }
    // Open the needed screen
    navigationController.pushViewController(DocumentViewController(id: documentId), animated: false)
    return true
}

In SceneDelegate (iOS 13+): scene(_:willConnectTo:options:) for new launch and scene(_:continue:) for already running application. Handle both cases.

What to Pass in userInfo

userInfo is limited: Property list types only (String, Int, Data, Array, Dictionary). Don't try to serialize NSManagedObject—it crashes. Maximum payload size—a few kilobytes. For large state: pass the identifier, load from iCloud or local cache on the receiving side.

Continuation stream. For files, there's NSUserActivity.addUserInfoEntries(from:) + transferUserInfoCompletionHandler. For actual data streaming—continuation stream through getContinuationStreams(). But this is rare—usually ID + reload is enough.

Typical Mistakes

becomeCurrent() not called. Without it, Handoff doesn't activate. Call in viewDidAppear, not in viewDidLoad.

invalidate() not called when leaving screen. If the activity isn't invalidated, the Handoff icon remains on other devices even when the task is complete. In viewDidDisappear or deinit: activity.invalidate() or self.userActivity = nil.

activityType mismatch between versions. If a new app version renames activityType, old devices receive an unknown type and Handoff silently fails. Version your activityType or handle old types.

Mac Catalyst and macOS

On Mac Catalyst, the same NSUserActivity API. Handoff works between iOS and macOS if the app exists on both platforms. For macOS AppKit—NSApplicationDelegate.application(_:continue:restorationHandler:).

Timeline

Basic Handoff implementation for 1–3 activity types: 1–2 weeks. Full integration with complex state, multiple screens, edge cases handling (no data, no network): 3–5 weeks. Cost is calculated after analyzing user scenarios.