【发布时间】:2016-07-17 16:08:58
【问题描述】:
我正在尝试移动一个文件,即使已经存在同名文件。
NSFileManager().moveItemAtURL(location1, toURL: location2)
NSFileManager 的方法moveItemAtURL 是否有覆盖选项?如何替换现有文件?
【问题讨论】:
-
删除目标文件,然后移动。
-
这个问题有很多 objc 答案。您也许可以将其中一些答案转换为 swift,例如 stackoverflow.com/questions/6137423/… 和 stackoverflow.com/questions/20683696/…
标签: ios swift file nsfilemanager