In my app I have:
let utterance = AVSpeechUtterance(string: recognizedTextView.text)
utterance.voice = AVSpeechSynthesisVoice(language: "zh-HK")
utterance.rate = 0.3
synthesizer.speak(utterance)
However, after I upgraded my iOS to 17.1.1 the speed doesn't get adjusted. I tried 0.01 and 0.3 for rate, and there is no difference.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I tried to change my code from
let urlString = Bundle.main.path(forResource: "X", ofType: "mp3")!
to
let urlString = Bundle.main.path(forResource: "X", ofType: "caf")!
after I already uploaded the file. But it throws a fatal error: Unexpectedly found nil while unwrapping an Optional value
I double check the filename and it's correct. and the caf file does play.
Something weird is happening? As I tested this on all the simulators including the physical phone, the search bar renders fine. However, when I quit Xcode and open the application on the phone, the search bar would not render with the correct width. (It would be all bunched up. It's hard to debug because this program isn't visible in any of the simulators.) Part of the code:
override func viewDidLoad()
{
super.viewDidLoad()
initList()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
initSearchController()
}
func initSearchController()
{
searchController.loadViewIfNeeded()
searchController.searchResultsUpdater = self
searchController.searchBar.sizeToFit()
searchController.searchBar.frame.size.width = self.view.frame.size.width
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.enablesReturnKeyAutomatically = false
searchController.searchBar.returnKeyType = UIReturnKeyType.search
searchController.isActive = false
searchController.searchBar.placeholder = "Search poetry, lyrics, arias ..."
searchController.definesPresentationContext = true
searchController.searchBar.delegate = self
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
}
Is it possible to do so? If so, how?