我正在使用自定义键盘扩展,然后从服务器下载键盘主题并保存到应用程序文档目录,但应用程序文档目录无法在自定义键盘扩展程序中访问,因此需要共享应用程序组目录。我该怎么办,请帮帮我。
现在我正在尝试这个,但它不起作用。
let fileManager = FileManager.default
if let directory = fileManager.containerURL(forSecurityApplicationGroupIdentifier: "group.companyname.appname") {
//let newDirectory = directory.appendingPathComponent(dataPath)
newDirectory = directory.appendingPathComponent("MyDirectory")
try? fileManager.createDirectory(at: newDirectory, withIntermediateDirectories: false, attributes: nil)
print(newDirectory.path)
}