如何删除iCloud文档? [英] How to delete iCloud documents?
本文介绍了如何删除iCloud文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用iCloud的UIDocument。我没有使用CoreData。删除UIDocument的最佳方法是什么?
I'm using a UIDocument with iCloud. I'm not using CoreData. What's the best way to delete a UIDocument?
推荐答案
要从iCloud中删除文档,首先必须获取所需的文件名删除。然后你可以使用NSFileManager删除它。
To delete the document from iCloud, first you have to get the filename you want to delete. and then you can delete it using NSFileManager.
NSString *saveFileName = @"Report.pdf";
NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
NSURL *ubiquitousPackage = [[ubiq URLByAppendingPathComponent:@"Documents"] URLByAppendingPathComponent:saveFileName];
NSFileManager *filemgr = [NSFileManager defaultManager];
[filemgr removeItemAtURL:ubiquitousPackage error:nil];
这是我用来删除文档的方式,请查看。
这对我来说很棒。
谢谢
This is the way, which i used to delete document, Check it out. It is woking great for me. Thanks
这篇关于如何删除iCloud文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文