How can upload a zip file into FTP server using swift 3 and iOS 10?

余生长醉 提交于 2019-12-08 09:48:38

问题


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.


回答1:


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

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")
        }
 }


来源:https://stackoverflow.com/questions/39982572/how-can-upload-a-zip-file-into-ftp-server-using-swift-3-and-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!