Loquatious
Loquatious

Reputation: 1775

FTP URL form @ character issue

I need to delete a file from FTP server. But with @ character in UserName making the issue to be failing the deletion with -11 error code.

(If my user name is like SampleUser then it's working fine)

Here is my sample code block:

SInt32 errorcode;

NSURL *fullURLWithEscape= [NSURL URLWithString:@"ftp://[email protected]:[email protected]/testfolder/imagetodelete.png"];
if (CFURLDestroyResource(( __bridge CFURLRef) self.fullURLWithEscape, &errorcode)) {
    // successful
}

else {
    // unsuccessful      
    // GETTING error code = -11  
}

Any help would be appreciated!

Upvotes: 0

Views: 48

Answers (1)

DarkDust
DarkDust

Reputation: 92336

The error code -11 means kCFURLUnknownSchemeError:

Indicates that the scheme is not recognized.

So the URL you've provided is not in a valid form. In a comment to a deleted answer of mine, you said you are encoding the password. If so, the URL should be ftp://User%40app.com:[email protected]/testfolder/imagetodelete.png (instead of [email protected] as in your question).

Make sure the URL is indeed encoded correctly (set a debug breakpoint, print the URL; if it's wrong, you need to find out why).

Upvotes: 1

Related Questions