I am trying to figure out how I should continue to install foxes under code using Swift 3.
let paths = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true) as NSArray for path in paths { let dir = path as! String print("the paths are \(path)") let urlToExclude = NSURL.fileURL(withPath: dir) do { try urlToExclude.setResourceValue(NSNumber(value: true), forKey: URLResourceKey.isExcludedFromBackupKey) } catch { print("failed to set resource value") } }
The error I get is this 
I used the code above to exclude files from backup in iCloud, and it worked fine for the previous version of Swift, but after upgrading to Xcode 8, I just got stuck.
I would really appreciate any help or suggestions.
ios ios10 swift3 xcode8 nsurl
Dushyant
source share