I have performed upload,download file from ftp using FTPHelper class. It's working perfectly.The issue generated in delete operation. While I'm deleting file from ftp server, nothing happens!. I don't know where I'm getting wrong. I have refered stackoverflow link to solve delete file from ftp but unable to do that.Below is my code to delete file from ftp.
pragma mark ***** Delete File From FTP
+(void)deleteFileFromFTPforItem:(NSString *) anItem
{
[sharedInstance deleteFileFromFTPforItem:anItem];
}
-(void)deleteFileFromFTPforItem:(NSString *) anItem
{
if (!self.uname || !self.pword) COMPLAIN_AND_BAIL(@"Please set user name and password first");
if (!self.urlString) COMPLAIN_AND_BAIL(@"Please set URL string first");
NSString *baseDeleteURL = [NSString stringWithFormat:@"%@/",self.urlString];
NSString *deleteFilePath = [baseDeleteURL stringByAppendingString:anItem];
CFURLRef deleteURL = (CFURLRef)[[NSURL alloc] initWithString:deleteFilePath];
//SInt32 *errorCode = NULL;
//CFURLDestroyResource(deleteURL, errorCode);
DeleteFile(deleteURL);
CFRelease(deleteURL);
}
static Boolean DeleteFile(CFURLRef urlToDelete)
{
Boolean success = true;
CFURLRef deleteURL = urlToDelete;
SInt32 *errorCode = NULL;
success = CFURLDestroyResource(deleteURL, errorCode);
return success;
}
Please give me a proper solution where am I going wrong.I have surfed lot of things but unable to get proper way to delete file from ftp.I have referred link to upload and download file to/from ftp.Your help would be appreciable.Thanks in advanced
To make a long story short, FTP support in NSURL and CFURL should be considered download-only. I don't think it ever fully worked, and ftp is thoroughly deprecated for any purposes other than anonymous downloads anyway, so it is unlikely to ever be fixed.
You can use other FTP access frameworks, as described in this question:
CFURLDestroyResource is now deprecated in iOS7. Anyone know what to use instead?
but really, you should probably be asking yourself whether using FTP is really the right way to do whatever you're trying to do, as opposed to (for example) WebDAV.