kasketis / netfox

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
MIT License
3.65k stars 368 forks source link

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

Closed anirudhamahale closed 1 year ago

anirudhamahale commented 2 years ago

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:

Additional context here is the link to the issue from Alamofire

ersinkhr commented 2 years ago

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

vGubriienko commented 2 years ago

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

renanstig commented 1 year ago

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

anirudhamahale commented 1 year ago

Yes it's been fixed @renanstig

Osein commented 1 year ago

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

`

renanstig commented 1 year ago

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