Let’s try voice recognition by using “Speech Recognition API” which is released in iOS 10.0.
Basically, I’ll explain the following official sample program.
- macOS Sierra 10.12.1
- Xcode 8.1
- iOS 10.1.1
At first, create a new project in Xcode.
Next, move to the project top, and execute
At this time, I don’t have a plan to use other libraries, so this step is not required.
Then, let’s open the directory whose extension is
From iOS 10, we have to write purposes to use features related to privacy access in
Info.plist. Otherwise, the app is terminated forcibly.
Info.plist as below.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSSpeechRecognitionUsageDescription</key> <string>sample description</string> <key>NSMicrophoneUsageDescription</key> <string>sample description</string> <!-- ... --> </dict> </plist>
ViewController.swift, and import the speech library.
I’ll write a coding part in next article, because it’ll be too long.
Look forward to it!