FLEXTool / FLEX

An in-app debugging and exploration tool for iOS
Other
14.03k stars 1.7k forks source link

Empty response for async bytes #646

Open flejmer opened 1 year ago

flejmer commented 1 year ago

Environment

Bug Report

I checked the FLEX networking debugger and requests that I make appear with empty response. That is not correct since I'm getting the data that is displayed on the app. I looked into similar issues mentioned in #603 and #611 but I'm not using firebase so it's not related. I do networking using concurrency so perhaps that could be part of an issue with FLEX. URLSession with bytes(for request: URLRequest, delegate: URLSessionTaskDelegate?) to be specific.

Mechanism in network history is listed as

NSURLSessionDataTask (delegate: _TtC10FoundationP33_1935C07EE287982D980AA89BB85ACEFA28URLSessionAsyncBytesDelegate)
Screenshot 2023-01-12 at 17 26 16
brianplattenburg-delta commented 1 year ago

Platform+Version: iOS 15.x, 16.2 FLEX Version: 5.22.10

I think this is an issue specific to iOS 16 with capturing the response body when using the new async interface methods of URLSession introduced in iOS 15's Foundation updates. (Not just bytes, I see it with data as well)

I am experiencing the same behavior only when using the new async interface for URLSession, specifically data(for: URLRequest, delegate: URLSessionTaskDelegate?). Any calls to the non-async interface of URLSession continue to be captured and displayed in FLEX.

In the iOS 16.2 simulator, FLEX behaves exactly as shown above in @flejmer 's post. The response body shows as empty and it shows as "Awaiting Response" in the list of requests even after the app has received and process data from this call.

The exact same code in an iOS 15.0 simulator does show responses in FLEX.

dmhts commented 1 year ago

I can confirm the same issue on my side.

NSExceptional commented 1 year ago

Hey! An example project would be really helpful if someone can make one :)

pwadowski commented 1 year ago

I can also confirm this issue. I use standard dataTask(with request:, completionHandler:) and multiple requests are marked as Awaiting Response.

brianplattenburg-delta commented 1 year ago

I took a quick stab at a demo project for this bug: https://github.com/brianplattenburg-delta/FLEXAsyncEmptyDemo

burakCokyildirim commented 9 months ago

Is there any progress for this issue?

chuck-gnaw commented 9 months ago

I had the same issue, empty response

nixzhu commented 6 months ago

Is there any progress on this issue?

chuck-gnaw commented 2 months ago

I have the same issue

NSExceptional commented 3 weeks ago

Hi all,

I took a stab at investigating this. I think the issue is that URLSession:dataTask:didReceiveResponse:completionHandler: is not called on URLSession

At the moment, it would require more work than I can spare to figure this one out. It will possibly involve hooking a Swift function, which is a delicate process. If anyone knowledgable with this sort of thing can help or offer any insight, it would be much appreciated!