diff --git a/samples/swift/ios/speech-samples/speech-samples/Info.plist b/samples/swift/ios/speech-samples/speech-samples/Info.plist index 5b531f7b2..b915dee8d 100644 --- a/samples/swift/ios/speech-samples/speech-samples/Info.plist +++ b/samples/swift/ios/speech-samples/speech-samples/Info.plist @@ -20,6 +20,8 @@ 1 LSRequiresIPhoneOS + NSMicrophoneUsageDescription + For microphone input testing UIApplicationSceneManifest UIApplicationSupportsMultipleScenes @@ -62,5 +64,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIUserInterfaceStyle + Light diff --git a/samples/swift/ios/speech-samples/speech-samples/ViewController.swift b/samples/swift/ios/speech-samples/speech-samples/ViewController.swift index d18377818..413166385 100644 --- a/samples/swift/ios/speech-samples/speech-samples/ViewController.swift +++ b/samples/swift/ios/speech-samples/speech-samples/ViewController.swift @@ -6,6 +6,7 @@ import UIKit import MicrosoftCognitiveServicesSpeech import Differ +import AVFoundation extension StringProtocol { var words: [SubSequence] { @@ -84,8 +85,14 @@ class ViewController: UIViewController { } @objc func pronunciationAssessmentWithMicrophoneButtonClicked(){ - DispatchQueue.global(qos: .userInitiated).async { - self.pronunciationAssessmentWithMicrophone() + AVAudioSession.sharedInstance().requestRecordPermission { granted in + if granted { + DispatchQueue.global(qos: .userInitiated).async { + self.pronunciationAssessmentWithMicrophone() + } + } else { + print("Microphone is not permitted!") + } } }