2017-11-07 6 views
1

にアップデートされた後で失敗する.sqliteのダウンロードに失敗する。私は最新のAlamofireライブラリ(4.5.1)を持っていることを確認しました。ポッドを使用してアンインストールして再インストールしました。私は、プロジェクトをきれいにして、それをデバッグしようとしましたが、私は問題を見つけることができません、私は一時的なURLがnilであることに注意してください。iOS 11.1にアップデートした後、Alamofire 4.5.1が

マイコード:

 let parameters: Parameters = [:] 

     var filePath: URL? 

     let destination: (URL, HTTPURLResponse) -> (URL, DownloadRequest.DownloadOptions) = { 
      (temporaryURL, response) in 

      if let directoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first, let suggestedFilename = response.suggestedFilename { 
       filePath = directoryURL.appendingPathComponent("\(suggestedFilename)") 
       return (filePath!, [.removePreviousFile, .createIntermediateDirectories]) 
      } 
      return (temporaryURL, [.removePreviousFile, .createIntermediateDirectories]) 
     } 

     Alamofire.download("https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3", method: .get, parameters: parameters, encoding: JSONEncoding.default, to: destination) 
      .downloadProgress { progress in 
       DispatchQueue.main.async 
       { 
        /.../       
       } 
      } 
      .validate { request, response, temporaryURL, destinationURL in 
       /.../ 
       return .success 
      } 
      .response { response in 

       debugPrint(response) 
       print("Descarga finalizada"); 
       /.../ 
      } 

.downloadProgressが正常に動作します。しかし、それは100%に達したときにプロセスが継続しないと、それが終了するまで待っているので、待ち時間の排出(-1001)

デバッグとコンソール出力は:

2017-11-07 12:04:28.422333+0100 Target[673:215766] Task <26F62B6A-FEB4-4908-92C9-D3F9C9886C81>.<4> finished with error - code: -1001 

Alamofire.DefaultDownloadResponse(request: Optional(https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3), response: Optional(<NSHTTPURLResponse: 0x1c0235220> { URL: https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3 } { Status Code: 200, Headers { 
    "Accept-Ranges" =  (
     bytes 
    ); 
    "Content-Length" =  (
     28086272 
    ); 
    "Content-Type" =  (
     "application/octet-stream" 
    ); 
    Date =  (
     "Tue, 07 Nov 2017 11:02:52 GMT" 
    ); 
    Etag =  (
     "\"xxxxxxxxxxxxxxxxx\"" 
    ); 
    "Last-Modified" =  (
     "Tue, 07 Nov 2017 01:44:00 GMT" 
    ); 
    Server =  (
     AmazonS3 
    ); 
    "x-amz-id-12" =  (
     "LiCdsdasdasfsdfdsffgsfdsw3o+npOhfUVLdZ/KlTWgLXdPNPU8iYnZIkeGoRvBkLbKwFFY=" 
    ); 
    "x-amz-request-id" =  (
     9CD8D133234DB 
    ); 
} }), temporaryURL: nil, destinationURL: nil, resumeData: Optional(7043 bytes), error: Optional(Error Domain=NSURLErrorDomain Code=-1001 "Se ha agotado el tiempo de espera." UserInfo={_kCFStreamErrorCodeKey=-2102, NSURLSessionDownloadTaskResumeData=<CFData 0x1c0649390 [0x1b1491310]>{length = 7043, capacity = 16384, bytes = 0x3c3f786d6c2076657273696f6e3d2231 ... 2f706c6973743e0a}, NSUnderlyingError=0x1c0649e10 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSLocalizedDescription=Se ha agotado el tiempo de espera., NSErrorFailingURLStringKey=https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3, NSErrorFailingURLKey=https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3, _kCFStreamErrorDomainKey=4}), timeline: Timeline: { "Request Start Time": 531745370.759, "Initial Response Time": 531745371.441, "Request Completed Time": 531745468.447, "Serialization Completed Time": 531745468.450, "Latency": 0.682 secs, "Request Duration": 97.688 secs, "Serialization Duration": 0.003 secs, "Total Duration": 97.691 secs }, _metrics: Optional((Task Interval) <_NSConcreteDateInterval: 0x1c003f5c0> (Start Date) 2017-11-07 11:02:50 +0000 + (Duration) 97.667806 seconds = (End Date) 2017-11-07 11:04:28 +0000 
(Redirect Count) 0 
(Transaction Metrics) (Request) <NSURLRequest: 0x1c00019d0> { URL: https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3, Method GET, Headers { 
    Accept =  (
     "*/*" 
    ); 
    "Accept-Encoding" =  (
     "gzip;q=1.0, compress;q=0.5" 
    ); 
    "Accept-Language" =  (
     "es-ES;q=1.0, fr-ES;q=0.9, en-ES;q=0.8" 
    ); 
    Connection =  (
     "keep-alive" 
    ); 
    "Content-Type" =  (
     "application/json" 
    ); 
    Host =  (
     "s3-eu-west-1.amazonaws.com" 
    ); 
    "User-Agent" =  (
     "Targer/1.7 (com.xxxxx.xxxxx; build:156; iOS 11.1.0) Alamofire/4.5.1" 
    ); 
} } 
(Response) <NSHTTPURLResponse: 0x1c0030ae0> { URL: https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3 } { Status Code: 200, Headers { 
    "Accept-Ranges" =  (
     bytes 
    ); 
    "Content-Length" =  (
     28086272 
    ); 
    "Content-Type" =  (
     "application/octet-stream" 
    ); 
    Date =  (
     "Tue, 07 Nov 2017 11:02:52 GMT" 
    ); 
    Etag =  (
     "\"6c9de7be53a1cdfser61ca7fa1a4\"" 
    ); 
    "Last-Modified" =  (
     "Tue, 07 Nov 2017 01:44:00 GMT" 
    ); 
    Server =  (
     AmazonS3 
    ); 
    "x-amz-id-2" =  (
     "LiCk24ajVvge+qcds5hgfbgdfxgnhFOhfUVLdZ/KlTWgLXdPNPU8iYnZIkeGoRvBkLbKwFFY=" 
    ); 
    "x-amz-request-id" =  (
     9CD8SDHD7B81DB 
    ); 
} } 
(Fetch Start) 2017-11-07 11:02:50 +0000 
(Domain Lookup Start) 2017-11-07 11:02:50 +0000 
(Domain Lookup End) 2017-11-07 11:02:50 +0000 
(Connect Start) 2017-11-07 11:02:50 +0000 
(Secure Connection Start) 2017-11-07 11:02:50 +0000 
(Secure Connection End) 2017-11-07 11:02:51 +0000 
(Connect End) 2017-11-07 11:02:51 +0000 
(Request Start) 2017-11-07 11:02:51 +0000 
(Request End) 2017-11-07 11:02:51 +0000 
(Response Start) 2017-11-07 11:02:51 +0000 
(Response End) 2017-11-07 11:03:27 +0000 
(Protocol Name) http/1.1 
(Proxy Connection) NO 
(Reused Connection) NO 
(Fetch Type) Network Load 

)) 

Descarga finalizada 

ただし、ファイルがしました

:私はのような簡単なバージョンを使用してファイルの保存先を変更した

App content Folder

:パスにダウンロードされて

しかし、問題は同じです。

iOS 10.3は完全に機能します。

ご協力いただきありがとうございます。

Iから追加のパラメータを削除することによってそれを解決した

答えて

0

:私が間違っているかわからないんだけどそれはそれは

をどのように動作するかだ

Alamofire.download("https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3", to: destination) 

:へ

Alamofire.download("https://s3-eu-west-1.amazonaws.com/xxx/xxx/xxx.sqlite3", method: .get, parameters: parameters, encoding: JSONEncoding.default, to: destination) 

関連する問題