应用程序包,当我从文件目录中的文件复制到应用程序包目录提示错误是这样的:无法被复制,因为您没有权限访问IOS
“图像”不能被复制,因为您没有权限访问“资源”。
我的代码
let fileManager = FileManager.default
let documentDirectoryPath = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("Images")
let bundleDirectoryPath = (Bundle.main.resourceURL?.appendingPathComponent("GCDWebUploader.bundle").appendingPathComponent("Contents").appendingPathComponent("Resources").appendingPathComponent("Images"))
do {
try fileManager.copyItem(at: documentDirectoryPath!, to: bundleDirectoryPath!)
} catch let error as NSError {
print("Couldn't copy file to final location! Error:\(error.description)")
}
为什么要将图像移动到您的包目录? –
我已经实施了简单的网络服务器与使用GCDWebUploader.And它做到了成功。但现在我想显示上传的图像从iphone到web.At那时我得到的问题资源未找到。因此,我得到了复制资源的解决方案但这样做,我正在获得许可的问题。 – Bhumi
这是否意味着您想要上传到外部服务器(使用GCDWebUploader)的文档目录中有图像?如果是这样的话,为什么你不显示你的上传代码,你如何从沙盒访问图像? –