Article

Deleting Donated Shortcuts

Remove your donations from Siri.

Overview

If your app donated a shortcut containing information that the user has since deleted, your app should delete the donation. For example, let's say that a user sends a message to a contact using your messaging app. Your app donates the send message shortcut that includes information about the contact. Later, the user deletes that contact from the app. The app should delete the donations it made that included the contact information.

When a user deletes data from an app, they expect the data to be gone for good. This means removing the data from the app as well as from the system—if the system has knowledge of that data. It’s important for your app to honor this unspoken agreement with the user: to maintain privacy and trust at all times.

There are other times your app should delete donations; for instance, when your app no longer supports the action. In general, whenever a donation is no longer appropriate for the user, your app should delete the donation.

Delete Interaction Donations

To delete donations made with interaction objects, use one of the delete class methods on INInteraction (see Deleting Interactions from the System). To delete specific donations, use delete(with:completion:), passing in the list of identifier strings for each interaction to delete. Or use delete(with:completion:), passing in the groupIdentifier string used to group of two or more interactions.

If you need to delete all interactions that your app donated—for example, when the user signs out of your app—use deleteAll(completion:).

Delete User Activity Donations

The method you use to delete a donation made with NSUserActivity depends on how you set up the user activity.

Persisted Activities

If user activity's isEligibleForPrediction property is set to true and the persistentIdentifier property is set to a unique string identifying the activity, then:

Spotlight Indexed Activities

If the user activity is indexed in Spotlight and the relatedUniqueIdentifier property is set to a unique string identifying the activity, then:

When you delete a Spotlight item, the system deletes the related user activity and its donations.

For more information about Spotlight indexing, see Core Spotlight.

See Also

Shortcuts

Donating Shortcuts

Tell Siri about shortcuts to actions that the user performed in your app.

Soup Chef: Accelerating App Interactions with Shortcuts

Make it easy for people to use Siri with your app by providing shortcuts to your app’s actions.

Shortcut Management

Enable users to add shortcuts to Siri, and have your app suggest shortcuts to users.

Relevant Shortcuts

Display shortcuts on the Siri watch face.

Media Intent Shortcuts

Provide a convenient way for users to listen to and watch media content from your app with shortcuts.

enum INShortcut

An action available in your app that the system may suggest to a user or a user may add to Siri.

class INInteraction

An interaction between the user and your app involving an intent object.

class INObject

An object that represents a custom intent parameter.