NSURL与http://工作正常,但ftp://不 [英] NSURL with http:// works fine but with ftp:// not
本文介绍了NSURL与http://工作正常,但ftp://不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NSString *adress = [NSString stringWithFormat:@"ftp://%@:%@@%@/%@x050-pegel.txt", benutzer.text, passwort.text, server.text, pfad.text];
NSURL *aURL = [[NSURL alloc]initWithString:adress];
NSString *theData = [NSString stringWithContentsOfURL:aURL];
textview.text = theData;
可以帮助我吗?
推荐答案
AFAIK,FTP支持不是Cocoa框架的一部分。您可以使用 + [NSString stringWithContentsOfURL:encoding:error:]
,并查看 NSError
对象,如下所示:
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);
}
google搜索cocoa ftp从Objective-C连接到FTP服务器。
A quick google search for "cocoa ftp" shows that there are several approaches to connecting to an FTP server from Objective-C.
这篇关于NSURL与http://工作正常,但ftp://不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文