使用S7FTPRequest上传到FTP时出现问题

时间:2010-08-02 14:50:58

标签: iphone ftp

我正在尝试使用S7FTPRequest将文件上传到FTP服务器:

S7FTPRequest *ftp = [[S7FTPRequest alloc] initWithURL:[NSURL URLWithString:@"ftp://ftp.abc.com/aaa/files/"]       
toUploadFile:[[NSBundle mainBundle] pathForResource:@"info" ofType:@"plist"]];

  ftp.username = @"name";
  ftp.password = @"pass";
  ftp.directoryName = @"/aaa/files/";
  ftp.delegate = self;
  ftp.filePath = @"/users/meir/Stuart-Highway.jpg";
  ftp.didFinishSelector = @selector(uploadFinished:);
  ftp.didFailSelector = @selector(uploadFailed:);
  ftp.willStartSelector = @selector(uploadWillStart:);
  ftp.didChangeStatusSelector = @selector(requestStatusChanged:);
  ftp.bytesWrittenSelector = @selector(uploadBytesWritten:);

  [ftp startRequest];

之后,我收到消息(在控制台中): 将传输44799个字节

它什么也没做。过了一会儿,我收到了一条超时消息。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

解决了问题。 那段代码很完美。您必须保持RunLoop运行才能运行循环。