问题
Why is that URL methods like moveItemAtURL:toURL:error:
of NSFileManager
class are recommended over Path methods like moveItemAtPath:toPath:error:
?
回答1:
When NSURL objects are created it's also checked that the path is valid, otherwise the object is not created.
The path ones are created even if it's an invalid path. There are no checks made at all.
来源:https://stackoverflow.com/questions/30023679/nsfilemanager-url-vs-path