Posts

Post not yet marked as solved
0 Replies
712 Views
I am trying to understand as to why following piece of code throws an assertion. What I am trying to do is to call asyncFunc() on main thread/main actor from call site. I don't want to decorate asyncFunc with @MainActor as I want the function to be thread agnostic. func asyncFunc() async -> String? { dispatchPrecondition(condition: .onQueue(.main)) return "abc" } func callSite() { Task { @MainActor in await asyncFunc() } } My understanding was that Task { @MainActor ...} would execute all the following code on MainActor/main thread.
Posted
by shanupam.
Last updated
.
Post not yet marked as solved
3 Replies
974 Views
Seems like on iOS 13 beta 5, AVSpeechSynthesizer tries to deactivate app's active audio session few seconds after AVSpeechSynthesizer instance has been created. Anyone else seeing this issue? Following code is able to reproduce the bug.import UIKitimport AVFoundationclass ViewController: UIViewController { private let speechRecognizer = AVSpeechSynthesizer() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let audioSession = AVAudioSession.sharedInstance() try? audioSession.setActive(true, options: []) }}
Posted
by shanupam.
Last updated
.