Wanted: URL to iCloud Drive's Downloads folder

I am trying to configure a UIDocumentPickerViewController so that when it is presented, it will show the contents of the user's iCloud Drive Downloads folder. This mean that I need to set its directoryURL property.

What I can't figure out is what to set that directoryURL to. I tried:

Code Block
crosswordPuzzleDownloadsURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)!.appendingPathComponent("Downloads")



but the app just crashes on that line, since url(forUbiquityContainerIdentifier:nil) returns nil.

I think this has something to do with iCloud Container Identifiers in the Entitlements File, but I can't find a good example that walks through this.

Anyways, without good documentation, I'm lost. Can someone please tell me how to accomplish what I hope is a simple task?
Wanted: URL to iCloud Drive's Downloads folder
 
 
Q