How to execute alamofire background upload request?

前端 未结 3 1976
小鲜肉
小鲜肉 2021-01-05 12:39

I need to send zip file to server side.

There is my request which I need to work in background

let configuration = URLSessionConfiguration.default
             


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 13:30

    from Background Transfer Considerations :

    Only upload tasks from a file are supported (uploading from data objects or a stream will fail after the program exits).

    that means it is limitation from NSURLSession - you need you upload from a file and then try to solve the other error with file

    Update

    appDeligate.log.debug("request was sended")
    
    let tempZipFilePath = UtilDirectory.tempZipPath.tweak()
    
    alamoFireManager.upload(tempZipFilePath,
                            to: deligate.url,
                            method: .post,
                            headers: headers)
    

提交回复
热议问题