I am trying to create a directory inside Application Support in iOS
let fileManager = FileManager.default
if let documentDirectory = fileManager.urls(for: .applicationSupportDirectory,
in: .userDomainMask).first {
let folderURL = documentDirectory.appendingPathComponent(storeName)
if !fileManager.fileExists(atPath: folderURL.path) {
do {
try fileManager.createDirectory(atPath: folderURL.path,
withIntermediateDirectories: true,
attributes: nil)
} catch {
print(error.localizedDescription)
}
}
This code is called inside application(_:didFinishLaunchingWithOptions:). It fails to create the directory with the error
You don’t have permission to save the file in the folder “Application Support"
Anyone facing this issue?