VoiceServicesPlugIns

From iPhone Development Wiki
Revision as of 09:41, 2 February 2017 by Kirb (talk | contribs) (Undo revision 4901 by Testatest (talk))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

VoiceServices plug-ins are plugins to the iOS voice dial feature. They provide possible results within plists and receive recognized results.

There is currently no plugin loader available. Developers have to "hard-code" their plugins by writing them in /System/Library/VoiceServices/PlugIns.

Currently, there is little known about the internals of VoiceServices plugins and their state of usability, especially on recent iOS versions.

iOS 6

In iOS 6 VoiceServices plugins can easily be loaded by creating an appropriate folder in /System/Library/VoiceServices/PlugIns. Plugins are slightly extended bundles and always have the suffix .vsplugin.

Info.plist

The bundle contains an Info.plist and its typical elements, like CFBundleIdentifier.

Additional keys are:

VSRecognitionVersion which contains a string. Most probably an internal version identifier. The Base plugin currently has 4.0 as value.

VSRecognitionModels which contains an array of dictionaries.

VSRecognitionModels

Every dictionary can contain the following keys:

Key Value type Function
VSRecognitionModelIdentifier String Obligatory. Complete function unknown, seems to be some kind of internal identifier to sort all the different recognition handlers.
VSRecognitionModelFileName String Obligatory. The file name of all the possible recognition results. A localized suffix will be added by the plugin loader, for example if your name is "org.h6nry.test.plist" and you are french, it will search for a file named "org.h6nry.test-fr.plist".
VSRecognitionResultHandler String Obligatory. The name of the class which is implemented in the bundle executable and which should handle the results for all the recognition results provided in VSRecognitionModelFileName.

VSRecognitionModelFileName plist files

These files are stored directly in the base directory of the bundle and are localized with "-lang-code" suffixes. They have the following base structure:

(xml and doctype plist references)
<dict>
    <key>VSRecognitionClasses</key>
    <array>
        <dict>
            <key>VSRecognitionClassIdentifier</key> <string>myClassIdentifier</string> <!-- Used for the VSRecognitionSequences array -->
            <key>VSRecognitionClassElements</key> <!-- Array of words which are going to be recognized -->
            <array>
                <string>string 1</string>
                <string>string 2</string>
                <string>Hello</string>
            <array>
        </dict>
    </array>

    <key>VSRecognitionSequences</key> <!-- Specifies in which sequence all the just defined keywords are spoken -->
    <array>
        <dict>
            <key>VSRecognitionSequenceElements</key>
            <array>
                <string>myClassIdentifier</string>
                <string>anotherClassIdentifier</string>
            </array>
        </dict>
        <dict>
            <key>VSRecognitionSequenceElements</key>
            <array>
                <string>someOtherClassIdentifier</string>
                <string>anotherClassIdentifier</string>
            </array>
        </dict>
    </array>
</dict>

This is just the very basic structure, there are other keys, objects and identifiers. Most of them can be obtained from the existing voice plugins, they are quite self-explanatory.

The executable

The executable should implement all of the classes specified in the VSRecognitionResultHandler keys. These classes should conform to the VSRecognitionResultHandler protocol, which can be found in class-dumps of SpringBoard. It is being linked to the VoiceServices private framework.

External links