iOS 文件提供程序扩展
iOS File Provider Extension
我正在为我的 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
每次我 google 这个错误它 returns 链接到 Apple,就像这个:
其中明确表示:
Note: This chapter describes property list keys specific to the macOS
implementation of App Sandbox. They are not available in iOS.
有人有添加此权利的经验吗?
好的,事实证明这与权利无关,而是我试图在沙箱中创建目录的方式。
最初是这样做的:
[_fileManager createDirectoryAtPath:[[url URLByDeletingLastPathComponent] absoluteString]
withIntermediateDirectories:true attributes:nil error:&dirError];
应该这样做:
[_fileManager createDirectoryAtURL:[url URLByDeletingLastPathComponent]
withIntermediateDirectories:true attributes:nil error:&dirError];
注意 createDirectoryAtPath
和 createDirectoryAtURL
之间的区别
无论如何希望这对以后的人有所帮助!
我正在为我的 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
每次我 google 这个错误它 returns 链接到 Apple,就像这个:
其中明确表示:
Note: This chapter describes property list keys specific to the macOS implementation of App Sandbox. They are not available in iOS.
有人有添加此权利的经验吗?
好的,事实证明这与权利无关,而是我试图在沙箱中创建目录的方式。
最初是这样做的:
[_fileManager createDirectoryAtPath:[[url URLByDeletingLastPathComponent] absoluteString]
withIntermediateDirectories:true attributes:nil error:&dirError];
应该这样做:
[_fileManager createDirectoryAtURL:[url URLByDeletingLastPathComponent]
withIntermediateDirectories:true attributes:nil error:&dirError];
注意 createDirectoryAtPath
和 createDirectoryAtURL
无论如何希望这对以后的人有所帮助!