Can System Extension write to file?

Hi,


I need to cache some data in my System Extension somewhere, even if the main app is not running. (So I can't use XPC.)


I tried writing into library directory:


FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)


Which didn't work. I tried also writing into UserDefaults, which also didn't work.



Is System Extension allowed to write anywhere? How would I go about caching small piece of data between system restarts?


Thank you!

Oh, I figured it out. It writes to container here:


/var/root/Library/Containers/my.app.MyAppExtension


I was expecting it in normal app container... But this makes a lot of sense. I can cache my data, but they will remain secure.

Can System Extension write to file?
 
 
Q