Recently switched to Xcode 13.
I have an AVAsset writer, and trying to call the method
writer.finishWriting()
which now has an async version, as well as the synchronous version.
I want to call the original synchronous version, but am getting the error:
"'async' call in a function that does not support concurrency.
Add 'async' to function to make it asynchronous"
How can I call the original synchronous/pre-Xcode 13 version?
CodePudding user response:
It looks like you forgot to add the trailing closure that the original function is expecting.
You want to use finishWriting(completionHandler:)
. The definition takes a trailing closure, completionHandler
:
func finishWriting(completionHandler handler: @escaping () -> Void)
If you add the trailing closure:
writer.finishWriting {
/* do stuff */
}
the code will compile as expected.