开发者

NSURL with http:// works fine but with ftp:// not

开发者 https://www.devze.com 2023-02-13 10:54 出处:网络
NSString *adress = [NSString stringWithFormat:@\"ftp://%@:%@@%@/%@x050-p开发者_运维技巧egel.txt\", benutzer.text, passwort.text, server.text, pfad.text];
NSString *adress = [NSString stringWithFormat:@"ftp://%@:%@@%@/%@x050-p开发者_运维技巧egel.txt", benutzer.text, passwort.text, server.text, pfad.text];

NSURL *aURL = [[NSURL alloc]initWithString:adress];

NSString *theData = [NSString stringWithContentsOfURL:aURL];

textview.text = theData;

can some one help me please ?


AFAIK, FTP support is not part of the Cocoa frameworks. You could get more information by using +[NSString stringWithContentsOfURL:encoding:error:] and looking at the NSError object, like so:

NSError *error = nil;
NSString *theData = [NSString stringWithContentsOfURL:aURL encoding:NSUTF8StringEncoding error:&error];
if (error != nil) {
  NSLog(@"received error: %@", error);
}

A quick google search for "cocoa ftp" shows that there are several approaches to connecting to an FTP server from Objective-C.

0

精彩评论

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