I'm creating an AVAssetDownloadURLSession
here's my code:
let config = URLSessionConfiguration.background(withIdentifier: "background")
let avSession = AVAssetDownloadURLSession(configuration: config, assetDownloadDelegate: self, delegateQueue: nil)
let any : Any = avSession
print("any as? AVAssetDownloadURLSession \(any as? AVAssetDownloadURLSession)") // always returns nil
Now, if I print out avSession
, it says it is an __NSURLBackgroundSession
, not an AVAssetDownloadURLSession
. If I assign avSession
to another variable (in this case an Any), and then downcast it later, it fails.
This is a real problem because I do need to do exactly this. Why can't I downcast this without failing? If I inspect the memory address of avSession
, and then inspect any in the debugger, they both have the same address. But it is most certainly (according to the debugger, and the runtime itself) not an AVAssetDownloadURLSession
.
Thanks for any help with this.