delete file on ftp server from iphone app

2019-06-13 15:59发布

问题:

i can't figure out how to delete a ftp file from inside an iphone app i'm creating. i'm able to establish a connection, create directories, upload files, get a list of files - but i don't see any way to delete files (or empty directories) via ftp. Does anyone have a code snippet for me? i couldn't find anything about this in Apples SimpleSampleFTP example code.

so far i tried using

Boolean CFURLDestroyResource(CFURLRef url, SInt32 *errorCode);

but it always returns FALSE and gives me error-code -11 (kCFURLUnknownSchemeError). The FTP connection needs authorization (username and password), but i don't know how to provide that when using CFURLDestroyResource?

回答1:

url = (CFURLRef)[[NSURL alloc] initWithString:@"ftp://user:password@ftpServer.com/fileToRemove"];