netfox icon indicating copy to clipboard operation
netfox copied to clipboard

Upload Progress Method from Alamofire don't called when use netfox

Open anirudhamahale opened this issue 3 years ago • 2 comments

Describe the bug I use Alamofire for network request & netfox for logging the request. The uploadProgress closure never gets called if I enable the netfox like so NFX.sharedInstance().start() in AppDelegate.

AF.upload(multipartFormData: { (multipartFormData) in
        multipartFormData.append(fileUrl, withName: "file")
        multipartFormData.append("\(id)".data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: "customer_id")
    }, to: Constants.kAddMedia, headers: Constants.kHeaders)
    .uploadProgress { (prgs) in
        progress(Float(prgs.fractionCompleted))
    }
    .responseJSON { response in
      // do my stuff 
    }
}

Enviroment:

  • Device: [e.g. iPhone 7]
  • OS: [e.g. iOS 15.1]
  • Netfox version: [e.g 1.20.0]
  • Alamofire version: [e.g 5.4]
  • Xcode version: [e.g 13.2.1]
  • Swift version: [e.g 5]

Additional context here is the link to the issue from Alamofire

anirudhamahale avatar Feb 08 '22 12:02 anirudhamahale

Same here. When I deintegrate Netfox pod, everything works.

ersinkhr avatar Feb 08 '22 14:02 ersinkhr

Thanks for the report. Will check as soon as possible.

vGubriienko avatar Feb 08 '22 18:02 vGubriienko

It's been more than a year, has this issue been fixed?

renanstig avatar Apr 12 '23 11:04 renanstig

Yes it's been fixed @renanstig

anirudhamahale avatar Apr 13 '23 03:04 anirudhamahale

I am using 1.21.0 version of netfox and 5.6.4 of Alamofire, in the below progress handler doesnt get called

` AF.upload(multipartFormData: { formData in

        for (key, value) in formFields {
            if let data = value.data(using: .utf8) {
                formData.append(data, withName: key)
            }
        }
        formData.append(url, withName: formFields["name"] ?? "attachment")
    }, with: request).uploadProgress { progress in
        progressHandler?(progress.fractionCompleted)
    }.responseData

`

Osein avatar Jul 02 '23 07:07 Osein

I am using 1.21.0 version of netfox and 5.6.4 of Alamofire, in the below progress handler doesnt get called

` AF.upload(multipartFormData: { formData in

        for (key, value) in formFields {
            if let data = value.data(using: .utf8) {
                formData.append(data, withName: key)
            }
        }
        formData.append(url, withName: formFields["name"] ?? "attachment")
    }, with: request).uploadProgress { progress in
        progressHandler?(progress.fractionCompleted)
    }.responseData

`

Unfortunately I have faced the same issue as you, even though they say the problem is fixed, it isn’t

my workaround to it was to deactivate Netfox before the upload starts and then restart it after it’s done

renanstig avatar Jul 02 '23 08:07 renanstig