Here is the full error:
Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “example.txt” in the folder “3DE44965-8931-4B4F-BD22-984217277704”."
UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/3DE44965-8931-4B4F-BD22-984217277704/example.txt,
NSUnderlyingError=0x280dc8d50 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Calling fileURL.startAccessingSecurityScopedResource() returns false.