ヴァーチャルマシン上で動かすとクラッシュして Thread 1 エラーが出ます。
import UIKit import AVFoundation class ViewController: UIViewController { @IBOutlet weak var image1: UIImageView! @IBAction func button3(_ sender: UIButton) { image1.image = UIImage(named: "kaka")! let talker = AVSpeechSynthesizer() // 話す内容をセット let utterance = AVSpeechUtterance(string: "kaka") // 言語を日本に設定 utterance.voice = AVSpeechSynthesisVoice(language: "ja-JP") // 実行 talker.speak(utterance) } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } }
回答1件
あなたの回答
tips
プレビュー