请使用以下代码:
Swift 4.0 和 Swift 3.0
let documentDirectory = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0])let DirPath = documentDirectory.appendingPathComponent("FOLDER_NAME")do{ try FileManager.default.createDirectory(atPath: DirPath!.path, withIntermediateDirectories: true, attributes: nil)}catch let error as NSError{ print("Unable to create directory (error.debugDescription)")}print("Dir Path = (DirPath!)")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)