大家好,我正在使用 SCRFTPRequest,https://github.com/Hackmodford/SCRFTPRequest在FTP服务器上上传文件,我以前用过它,效果很好,但现在我有一个使用ARC的项目,几天前API被重新编码为ARC。
我崩溃了,我不知道为什么,在startRequest之后崩溃,没有任何错误消息,整个函数被执行,包括startUploadRequest。我真的不知道为什么会崩溃。我已经在带有 5.0 的 iPAD 1 和带有 6.1 的 iPad 3 上进行了测试。
我尝试过其他文件,同样的问题,该文件是在 FTP 服务器上创建的,名称正确,但大小为 0 Kb。
filePath = [[NSBundle mainBundle] pathForResource:@"Spiriva Mentiones Legales" ofType:@"pdf"];
SCRFTPRequest *ftpRequest = [[SCRFTPRequest alloc] initWithURL:[NSURL URLWithString:@"ftp://ftp.belersoft.ro/"]
toUploadFile:filePath];
ftpRequest.username = @"user";
ftpRequest.password = @"pass";
ftpRequest.delegate = self;
ftpRequest.customUploadFileName = [modifiedPathWithXLS lastPathComponent];
[ftpRequest startRequest];
我已经实现了所有委托(delegate)回调,只有 ftpRequestWillStart 会被调用
最佳答案
如果其他人遇到“零字节文件上传”问题需要帮助,请尝试替换
[ftpRequest startRequest];
与
[ftpRequest startAsynchronous];
并将以下委托(delegate)方法添加到您的代码中:
- (void)ftpRequest:(SCRFTPRequest *)request didChangeStatus:(SCRFTPRequestStatus)状态
(请注意方法名称与 SCRFTPRequest 文档中列出的方法名称之间的区别。)
我对这个库还不够熟悉,还不能轻松地更改库本身,但调整委托(delegate)方法名称和使用异步对我来说很有效。
关于iphone - 在 ARC 上使用 SCRFTPRequest 进行 iOS FTP 上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14463595/