Remove your donations from Siri.
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:, passing in the list of
identifier strings for each interaction to delete. Or use
delete(with:, passing in the
group 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
Delete User Activity Donations
The method you use to delete a donation made with
NSUser depends on how you set up the user activity.
delete, passing in the list of persistent identifiers, to delete individual activities. This method also deletes user activities stored by Core Spotlight that have a matching persistent identifier.
Saved User Activities(with Persistent Identifiers: completion Handler:)
deleteto delete all activities saved by your app; for example, after the user signs out of your app. This method also deletes all user activities created by your app and stored by Core Spotlight.
All Saved User Activities(completion Handler:)
Spotlight Indexed Activities
If the user activity is indexed in Spotlight and the
related property is set to a unique string identifying the activity, then:
deleteto delete specific Spotlight items.
Searchable Items(with Identifiers: completion Handler:)
deleteto delete Spotlight items grouped by domain identifiers.
Searchable Items(with Domain Identifiers: completion Handler:)
deleteto delete all searchable items that your app contributed to Spotlight from the index.
All Searchable Items(completion Handler:)
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.