Instance Method

setVocabulary:ofType:

Registers the specified vocabulary strings with the user.

Declaration

- (void)setVocabulary:(NSOrderedSet<id<INSpeakable>> *)vocabulary ofType:(INVocabularyStringType)type;

Parameters

vocabulary

The speakable content to associate with the specified type. Each item should contain terms that are unique to your app and to the specific user. Sort the items in descending order of importance. In other words, the first item should be the most important, followed by items of decreasing importance. Each item must be no more than 1024 bytes in size.

type

The designated purpose for the strings in the vocabulary parameter. You must specify one of the designated types. You cannot specify custom types of strings. For a list of possible values, see INVocabularyStringType.

Discussion

Use this method to register user-specific vocabulary terms of the specified type. You may register different sets of strings for each of the supported types, but you may register only one group of strings for each type. Calling this method again for a given type replaces the previously registered strings already assigned to that type.

Don’t use this method to register terminology that’s common to all users of your app. Use this method only to register terms that are specific to the current user. Include common terminology in the vocabulary property list file that you include with your Intents extension.

Calling this method isn’t a guarantee that Siri uses the terms you supply. If you specify more than just a few strings, Siri may ingest only the first few strings rather than the entire list. So always place the most important strings first in the ordered set. In addition, if any of the strings exceed the maximum size limit, Siri ignores them.

It’s a programmer error to register terms that aren’t supported by any of your extension’s intents.

See Also

Updating the User-Specific Vocabulary

INVocabularyStringType

Possible usages for a custom vocabulary term.

- setVocabularyStrings:ofType:

Registers the specified vocabulary strings with the user.

- removeAllVocabularyStrings

Removes all user-specific vocabulary strings.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software