I am having the same issue (and same error code -17508) using AssetWriter to finisheWriting an .mp4 file with h.264 encoding into an App group's shared folder from a ReplayKit Upload Extension.
I was not able to find -17508 anywhere, and the complete error is:
Asset Writer Error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-17508), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x280314d80 {Error Domain=NSOSStatusErrorDomain Code=-17508 "(null)
Any ideas, what could be the issue?
UPDATE: I figured out that in my case it was the output URL that was the problem.
I used the following code to get the output URL of the folder shared (via App Group) between my app and my extension:
let appGroupsFolderUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.mycompany")
let outputURL = appGroupsFolderUrl!.appendingPathComponent("recording.mp4")
Appears, you cannot store in that folder directly, but you need to store your file in a subfolder, e.g. like this:
let appGroupsFolderUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.equalities")
let outputURL = appGroupsFolderUrl!.appendingPathComponent("Library/Caches/recording.mp4")
Note the Library/Caches part in the URL!
Still, it is kind of ridiculous that in 21st century development frameworks, you still get a "-17508" error that is not listed anywhere, when really what should have been returned is a proper error describing what the actually problem is.