Apple'sinstructionsforcreatingatemporaryURL将使用FileManager.url(for:in:appropriateFor:create:)。他们给出的例子是(用Swift3重写):letdesktopURL=URL(fileURLWithPath:"/Users/Noah/Desktop/")do{lettemporaryDirectoryURL=tryFileManager.default.url(for:.itemReplacementDirectory,in:.userDomainMask,appropriateFor:desktop