我必须在组容器内创建一个文件夹。我使用了以下代码
NSError* error;
BOOL state = [[NSFileManager defaultManager] createDirectoryAtPath:somepath withIntermediateDirectories:YES attributes:nil error:&error];
该应用程序是一个沙盒应用程序,在执行上述代码时观察到以下错误。这个问题的解决方案是什么?
Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “somepath” in the folder
“Group Containers”." UserInfo=0x21111c0
{NSFilePath=/Users/admin/Library/Containers/mypath/Data/../../../Group Containers/somepath,
NSUnderlyingError=0x21517c0 "The operation couldn’t be completed.
Operation not permitted"}
(为便于阅读,手动包装了错误消息。)