如何使用Swift 3和iOS 10将zip文件上传到FTP服务器? [英] How can upload a zip file into FTP server using swift 3 and iOS 10?

查看:83
本文介绍了如何使用Swift 3和iOS 10将zip文件上传到FTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Swift 3和iOS 10将zip文件上传到FTP服务器?我需要在我的应用中执行此操作以发送日志文件.

How can upload a zip file into FTP server using swift 3 and iOS 10? I need to do this in my app to send logs files.

推荐答案

您可以使用此框架将文件上传到FTP服务器: https://github.com/Constantine-Fry/rebekka

You can use this framework to upload files to an FTP server: https://github.com/Constantine-Fry/rebekka

有了这个,您只需要在AppDelegate中设置配置(例如

With this, you just need to set configuration in AppDelegate (like this) and to upload you use this code:

if let URL = NSBundle.main.URL(forResource:"MyLog", withExtension: "zip") {
        let path = "/upload/\(UUID.init().uuidString).zip"
        self.session.upload(URL, path: path) {
            (result, error) -> Void in
            print("Upload file with result:\n\(result), error: \(error)\n\n")
        }
 }

这篇关于如何使用Swift 3和iOS 10将zip文件上传到FTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆