开发者

Ftp Url With space in Objective-c

开发者 https://www.devze.com 2023-02-08 06:11 出处:网络
I cant access to the this ftp url with the apple ftpsample: ftp://192.168.1.20/Lavori/Andrea Baccin/ the space in the name of the folder make a \"Invalid URL\" error

I cant access to the this ftp url with the apple ftpsample:

ftp://192.168.1.20/Lavori/Andrea Baccin/

the space in the name of the folder make a "Invalid URL" error

if i can encode the url with:

url = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];

that make me this error:

[CALayer appendBytes:length:]: unrecognized selector sent to instance 0x184890

some help?

Thankyou guys!

开发者_运维问答sorry for my english.


Seems like your url object is not an NSString at runtime. Have you tried debugging this line ?

here is a working sample code :

NSString *url = @"ftp://192.168.1.20/Lavori/Andrea Baccin/";
url = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSLog(@"%@",url);

The console shows :

[Session started at 2011-02-02 14:23:48 +0100.] 2011-02-02 14:23:51.515 UISpec[669:207] ftp://192.168.1.20/Lavori/Andrea%20Baccin/

Hope this helps, Vincent


It seems that your error is not related to

url = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];

I think you have some items the overreleased. Recheck your code on memory management issues, or post more source code here.

0

精彩评论

暂无评论...
验证码 换一张
取 消