NSString *newPath = [[theFileName stringByDeletingLastPathComponent] stringByAppendingPathComponent:str];
[[NSFileManager defaultManager] movePat开发者_JS百科h:myString1 toPath:newPath handler:nil];
warning message?: NSFileManager may not respond to '-movePath:toPath:handdler'
what is that?
movePath: is a deprecated function as of Mac OSX 10.5+
Which version of iOS/MacOSX are you targeting?
Also, Apple suggest to use moveItemAtPath:toPath:error:
instead.
You should use moveItemAtPath:toPath:error:
not movePath:toPath:handler:
.
The movePath:toPath:handler:
is not available on iOS.
Look at NSFileManager Class Reference for iOS.
You probably need moveItemAtPath:toPath:error:
.
NSError * error = nil;
[[NSFileManager defaultManager] moveItemAtPath:oldPathInFull toPath:newPathInFull error:&error];
if ( error ) {
/* Error renaming the file. */
}
You can look at this tutorial
too.
精彩评论