macOS App .documentDirectory in App Extension

398 Views Asked by At

I've faced an issue, where while I'm trying to get .documentDirectory from my app, I get /Users/<Username>/Documents

But when I'm trying to do exact same thing from App Extension I get /Users/<Username>/Library/Containers/<Extension Bundle Identifier>/Data/

So the question is: Is there any possible way to get /Users/<Username>/Documents from App Extension.

Code that I'm trying to use to get .documentDirectory:

guard let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else {
     return
}

print(documents.path)
0

There are 0 best solutions below