草庐IT

setResourceValue

全部标签

macos - setResourceValue NSURLTagNamesKey 错误

尝试使用setResourceValue将标签颜色蓝色设置为文件时出现错误:varerror:NSError?letlistofTags=NSWorkspace.sharedWorkspace().fileLabelslettheURL:NSURL=NSURL.fileURLWithPath("/Volumes/234567_fr.tif")!varTag:AnyObject=NSWorkspace.sharedWorkspace().fileLabels[4]//Tag="Blue"theURL.setResourceValue(Tag,forKey:NSURLTagNamesKey

ios - URLResourceValue 和 setResourceValues Swift 3

我正在尝试弄清楚我应该如何使用Swift3继续修复下面的代码。letpaths=NSSearchPathForDirectoriesInDomains(.libraryDirectory,.userDomainMask,true)asNSArrayforpathinpaths{letdir=pathas!Stringprint("thepathsare\(path)")leturlToExclude=NSURL.fileURL(withPath:dir)do{tryurlToExclude.setResourceValue(NSNumber(value:true),forKey:URL