Cocoa移动目录

Cocoa移动目录,cocoa,nsfilemanager,Cocoa,Nsfilemanager,如何在cocoa中移动目录 每当我使用NSFileManager时,都会出现一个错误 NSFileManager* fileManager = [NSFileManager defaultManager]; [fileManager moveItemAtPath:[srcpath retain] toPath:[dstpath retain] error:&error]; 我最终得到了一个错误: 无法将nameOfDir1移动到nameOfDir2 哦,我必须在我要复制到的目录之后输入

如何在cocoa中移动目录

每当我使用NSFileManager时,都会出现一个错误

NSFileManager* fileManager = [NSFileManager defaultManager];
[fileManager moveItemAtPath:[srcpath retain] toPath:[dstpath retain] error:&error];
我最终得到了一个错误:

无法将nameOfDir1移动到nameOfDir2


哦,我必须在我要复制到的目录之后输入我要复制的目录名。

哦,我必须在我要复制到的目录之后输入我要复制的目录名。

是的。如果在目标路径中省略了名称,NSFileManager将不会暗示源目录的名称;它会看到您传递了一个已经存在的目标目录,并拒绝该目录。是。如果在目标路径中省略了名称,NSFileManager将不会暗示源目录的名称;它看到您传递了一个已经存在的目标目录,并拒绝了它。为什么要保留这些路径?为什么要保留这些路径?