更新时间:2023-01-31 22:31:56
我得到了它的工作。由于我不需要从扩展名编写文件,我认为我不需要使用 NSFileCoordinator
。结果 NSFileManager
有一个方法 containerURLForSecurityApplicationGroupIdentifier()
用于检索容器URL。
I got it to work. Since I don't need to write the file from the extension, I don't think I need to use NSFileCoordinator
. Turns out NSFileManager
has a method containerURLForSecurityApplicationGroupIdentifier()
for retrieving the container URL.
let manager = NSFileManager()
let containerURL = manager.containerURLForSecurityApplicationGroupIdentifier("group.MyGroupIdentifier")
let filePath = "\(containerURL.path)/config.plist"
let settings = NSDictionary(contentsOfFile: filePath)