检测文件是否在iCloudDrive废纸in中 [英] Detect if file is in iCloudDrive Trash
本文介绍了检测文件是否在iCloudDrive废纸in中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以检测位于iCloudDrive上的文件是否已移至iCloudDrive回收站? 我可以检查URL中是否包含".Trash",但我正在寻找一种检索此文件的正式方法.
Is there a way to detect if a file located on iCloudDrive has been moved to the iCloudDrive trash? I could check the URL to contain ".Trash" but I am looking for an official way to retrieve this.
推荐答案
要检测文件/文件夹是否位于垃圾箱"中,请使用以下代码:
To detect if a file/folder is in Trash use following code:
NSURLRelationship relationship;
NSError *error;
[[NSFileManager defaultManager] getRelationship:&relationship ofDirectory:NSTrashDirectory inDomain:0 toItemAtURL:URL error:&error];
if (relationship == NSURLRelationshipContains) {
//file is in trash
}
这篇关于检测文件是否在iCloudDrive废纸in中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文