1

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?

George
  • 25,988
  • 10
  • 79
  • 133

1 Answers1

1

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.

George
  • 25,988
  • 10
  • 79
  • 133
nSquid
  • 763
  • 1
  • 8
  • 15