我正在为我的iOS应用程序开发文件提供程序扩展。一切都在工作,除非我尝试将文件保存到磁盘时它会一直返回此错误:
Error Domain=NSPOSIXErrorDomain Code=2 "couldn't issue sandbox extension com.apple.app-sandbox.read-write for '/Users/Dlabs/Library/Developer/CoreSimulator/Devices/57330867-0570-46C8-8127-CAF8FE9F23A6/data/Containers/Shared/AppGroup/2F5EBE63-6FE5-47AE-BA55-BE47C5ED3FB1/File Provider Storage/0DCCF3F0-083A-4CBB-8C97-E98917DE8C53.jpg/0DCCF3F0-083A-4CBB-8C97-E98917DE8C53.jpg': No such file or directory"
让我难过的部分是:
couldn't issue sandbox extension com.apple.app-sandbox.read-write
每次我谷歌这个错误都会返回Apple的链接,就像这个:
明确说:
注意:本章介绍特定于macOS的属性列表键 App Sandbox的实现。它们在iOS中不可用。
是否有人有添加此权利的经验?
答案 0 :(得分:0)
好的,事实证明这与权利无关,而是我试图在沙箱中创建目录。
[_fileManager createDirectoryAtPath:[[url URLByDeletingLastPathComponent] absoluteString]
withIntermediateDirectories:true attributes:nil error:&dirError];
[_fileManager createDirectoryAtURL:[url URLByDeletingLastPathComponent]
withIntermediateDirectories:true attributes:nil error:&dirError];
请注意createDirectoryAtPath
和createDirectoryAtURL
无论如何希望这可以帮助将来的某个人!