iOS App Group Directory write not permitted

Viewed 128

When my app is launching I am creating the directory to store some files that later can be shared with extension.

To get the directory I am calling:

let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "com.poster")

Afterwards I am trying to create a custom caches directory.

let posterCachesURL =  containerURL.appendingPathComponent("PosterCaches")

do {
   try FileManager.default.createDirectory(at: posterCachesURL, withIntermediateDirectories: true)
} catch {
   // ... logging error
}

This works just fine, however in production environment some users get this error:

Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file "PosterCaches" in the folder ***folderID***." 
UserInfo={NSFilePath=.../PosterCaches, 
NSUnderlyingError=0x2401a00c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

Have anyone faced this issue?

Thank you in advance!

0 Answers
Related