iphone - 在 ARC 上使用 SCRFTPRequest 进行 iOS FTP 上传

标签 iphone ios xcode automatic-ref-counting

大家好,我正在使用 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/

相关文章:

ios - 向苹果商店提交应用程序(验证问题)

iphone - 显示当前周的开始和结束日期

ios - iOS 上的 fft numpy 风格以非二次方数据长度加速

ios - 将多个 UITextFiled 附加到同一个 IBAction 不会保留触发事件

ios - 在 facebook 中出现此错误 (com.facebook.error.2 )

iphone - 横向模式下的 UIPicker 大小调整

ios - 安装升级的iOS应用后,如何找出点击了哪个Facebook移动安装广告

ios - bundle 中包含的 Realm 不会迁移

objective-c - 如何使用代码旋转 iOS 模拟器?

xcode - NSTableCellView 设置可编辑