Mobile Development 16 min read

Integrating Siri Shortcuts into iOS Apps: A Practical Guide

This practical guide walks iOS developers through integrating Siri Shortcuts—from understanding the feature and handling bugs like the custom intent UI issue, to implementing Add‑to‑Siri buttons, watch‑face support, forced donations, intent versus NSUserActivity choices, and essential localization, enabling voice‑driven interactions on iOS 12 and later.

NetEase Media Technology Team
NetEase Media Technology Team
NetEase Media Technology Team
Integrating Siri Shortcuts into iOS Apps: A Practical Guide

Last year the author attended WWDC 2018 and later started a small‑scale integration of Siri Shortcuts into an iOS app. This article records the whole adaptation process, from concept to implementation, and shares practical tips for developers who need to support Siri Shortcuts on iOS 12 and later.

1. Overview of Siri Shortcuts

Siri Shortcuts originated from Apple’s acquisition of workflow and builds on existing technologies such as CarPlay , NSUserActivity , and HandOff . The feature allows apps to expose frequently used actions to Siri, Spotlight, or the Siri UI, reducing user friction.

Accelerating App Interactions with Shortcuts

2. Adaptation Work

The author lists several practical issues encountered during integration:

2.1 Custom Intent UI bug : When invoking Siri UI, the intentHandlingStatusSuccess is not returned, while Spotlight does return it. The bug is tracked under Radar 44375523 and remains unresolved in newer SDKs.

2.2 Add‑to‑Siri button : The button INUIAddVoiceShortcutButton is recommended by Apple but has limited UI customization. Four visual styles are shown, and the button can present two view controllers: present Add Voice Shortcut VC present Edit Voice Shortcut VC Localization of the button strings is done by adding entries to the Localizable.strings files for Simplified Chinese, Traditional Chinese, and Taiwanese: "Add to Siri" = "添加到 Siri"; "Added to Siri" = "已添加到 Siri"; "Add to Siri" = "加入 Siri"; "Added to Siri" = "已加入 Siri"; "Add to Siri" = "加至 Siri"; "Added to Siri" = "已加至 Siri";

2.3 Siri Watch Face support : If the app already supports Apple Watch, the same shortcuts can be exposed on the watch. Developers create INRelevantShortcut objects with providers such as INDateRelevanceProvider , INLocationRelevanceProvider , or INDailyRoutineRelevanceProvider (e.g., INDailyRoutineSituationMorning ).

2.4 Forcing Donate : When a shortcut is never used, it won’t appear in Siri suggestions. Developers can force a donation at app launch: [INVoiceShortcutCenter sharedCenter] setShortcutSuggestions:(NSArray *)suggestions];

2.5 Choosing between NSUserActivity and Intent : Use NSUserActivity when the shortcut must open the app; use Intent for actions that can be completed without launching the app. The author standardizes on Intent for all shortcuts.

2.6 Intent Localization : Apple may reject an app if custom intents lack localized titles. The fix is to add the missing keys in the intent definition’s localization files (e.g., zh‑hans, zh‑hant).

3. Detailed Implementation

3.1 The shortcut creation flow involves either NSUserActivity or Intents . The author prefers Intents for its ability to run actions without opening the app.

3.2 Defining an Intent: Create a SiriKit definition file (File → New → SiriKit Definition File) and add custom intents such as Play Media Intent or a custom “open dialog” intent.

3.3 Donating an Intent:

- (void)donateTrackNewsIntentWith:(NSArray
*)tracks { /* implementation */ }

Creating a media intent:

INPlayMediaIntent *playIntent = [[INPlayMediaIntent alloc] initWithMediaItems:mediaIntents mediaContainer:container playShuffled:@(NO) playbackRepeatMode:INPlaybackRepeatModeAll resumePlayback:@(0)];

Donating to the system:

INInteraction *interaction = [[INInteraction alloc] initWithIntent:playIntent response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) { /* handle error */ }];

3.4 Handling the Intent in the app delegate:

- (void)application:(UIApplication *)application handleIntent:(INIntent *)intent completionHandler:(void(^)(INIntentResponse *intentResponse))completionHandler {
    // Parse INPlayMediaIntent, perform network request, then:
    INPlayMediaIntentResponse *response = [[INPlayMediaIntentResponse alloc] initWithCode:INPlayMediaIntentResponseCodeSuccess userActivity:nil];
    completionHandler(response);
}

3.5 Custom Intent UI: Implement configureViewForParameters to update the UI based on interaction.intentHandlingStatus . If no custom UI is provided, the system shows a default panel with app icon, title, and subtitle.

3.6 Built‑in view controllers for adding/editing shortcuts:

INUIAddVoiceShortcutViewController

INUIEditVoiceShortcutViewController

4. Summary

The integration of Siri Shortcuts is a niche but valuable path for iOS developers. Early adoption faces bugs (e.g., Radar 44375523) and limited documentation, especially for localization and watch‑face support. Nevertheless, with careful handling of intents, donations, and UI customization, developers can provide powerful voice‑driven interactions that improve user engagement.

Mobile DevelopmentiOSSwiftlocalizationIntentsSiri Shortcuts
NetEase Media Technology Team
Written by

NetEase Media Technology Team

NetEase Media Technology Team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.