Files Selected with UIDocumentPickerViewController Ending Up in File Provider Storage [SwiftUI]

I often use security-scoped bookmarks when I develop a desktop application in Cocoa. This time, I need to use them in an iOS app, using SwiftUI framework.

I don't quite remember the history, but I use UIDocumentPickerViewController through UIViewControllerRepresentable to let the user select a file. And I have a model where I save file name, file path, its bookmark (Data) with NSKeyedArchiver.. And everything goes well when I run the app in a simulator.

Yet, FileManager says each file in the model does not exist. One of the path is something like the following.

/private/var/mobile/Containers/Shared/AppGroup/749F05F0-12BC-40AC-B5C4-72571145C624/File Provider Storage/Test/somefile.txt

Since it doesn't exist, I cannot even resolve it. How can I resolve the bookmark if a file ends up at the File Provider Storage folder? Do I need a special capability that I don't know about or something? Thanks.

It sounds like I've screwed up a big time according to RayWenderlich's article. https://www.raywenderlich.com/697468-ios-file-provider-extension-tutorial

Files Selected with UIDocumentPickerViewController Ending Up in File Provider Storage [SwiftUI]
 
 
Q