我注意到,一旦我完成它,它将导入的文件放入documents / InBox.
我的应用程序应该删除这些文件还是 *** 作系统最终会清除它们?
如果是这样,怎么样?我试过了:
[[NSfileManager defaultManager] removeItemAtPath:[self.url path] error:nil];
但是它似乎没有引用收件箱中的文件,即使self.url是我的导入文件的正确路径.
解决方法 系统不会清除导入的文件,因此您应该在必要时手动清除它们,但不要删除documents目录.如何清除NSdocumentsDirectory,你可以找到here
如果要从收件箱中删除文件,请使用相同的代码添加
...Nsstring *path = [Nsstring stringWithFormat:@"%@/InBox",documentsDirectory ];NSArray *directoryContents = [fileMgr contentsOfDirectoryAtPath:error:&error];...
阅读reference
来自apple doc:
总结Use this directory to access files that your app was asked to open by
outsIDe entitIEs. Specifically,the Mail program places email
attachments associated with your app in this directory; document
interaction controllers may also place files in it.Your app can read and delete files in this directory but cannot create new files or write to existing files. If the user trIEs to edit
a file in this directory,your app must silently move it out of the
directory before making any changes.The contents of this directory are backed up by iTunes.
以上是内存溢出为你收集整理的iphone – 您需要从Documents / Inbox中删除导入的文件吗?全部内容,希望文章能够帮你解决iphone – 您需要从Documents / Inbox中删除导入的文件吗?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)