FLEXTool / FLEX

An in-app debugging and exploration tool for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Response Body not in Cache for iOS 15

vijaytholpadi opened this issue · comments

Environment

  • Platform+version: iOS 15
  • FLEX version: 4.4.1, 4.5.0, 4.6.0

Bug Report

  • When trying to access the network request body on iOS 15, FLEX says Response Body: not in cache
  • This seems to be only happening on iOS 15.
  • I was able to verify the working functionality on the same app and the same API call on iOS 14.5 and I am able to view the Response Body there.
  • This issue affect both the Device as well as the simulator.
  • I tried the FLEX Example app on Xcode 13 iOS 15 simulator but do not see the issue there.

Please let me know if there are more details I can add to help debug this.

Any hints on where one could start looking? Happy to work on a PR.

Image:

Notes:

Looks like a similar issue was reported here but it lacked sufficient detail.

I have been having the same issue

commented

not support iOS 15+ ?

this can be installed without jailbreak or something? How did you get it to work on ios 15?

Took sometime to investigate this and figured out that it seems to only be not working on iOS 15 for requests that use Alamofire in our setup. We are currently on an older version of Alamofire (v4.8.2). The other request which directly use NSURLSession are having the response bodies shown perfectly in FLEX.

On digging deeper, looks like the issue is that the URLSessionDataDelegate methods are no longer getting callbacks on the Alamofire's SessionDelegate’s extensions in iOS 15. This seems to working perfectly fine in iOS 14.5.

I am yet to try this on the latest version of Alamofire in a demo project.

Can others confirm the details of the networking stack that they are using and if they is an isolated issue with Alamofire?

Can you upload the demo project you created?

@NSExceptional I tried the following combinations in a demo project and still was not able to reproduce the issue. Will try to add more dependencies that our project uses to the demo project and keep you posted if I can reproduce it.

Tested combinations which work fine:

  1. Alamofire 4.8.2 + FLEX 4.6.1
  2. Alamofire 5.5 + FLEX 4.6.1

I encounter the same issue. Is there any update or solution regarding this? Thanks.

Facing the same issue, tried FLEX 4.6.1 still can't see the response

If anyone can point me to an app on the app store or an open source app / demo project where this occurs, I can debug it. Otherwise, all I can do is wait for one of you to identify the issue

@NSExceptional

I spent some more time to trace the root cause of this issue as it is still happening in our codebase as of 4.7.0.

I again tried to walkthrough the flow on iOS 15 simulator in our codebase.

Observations:

  1. No calls fail to record the response on iOS 14. Also, not all calls fail to record response bodies on iOS 15. The calls which are failing to record the response body on iOS 15 are the ones which are going through Alamofire. Other calls which are successfully recording the response body are ones being made directly via URLSession.

  2. The calls which are missing the response body in the network debugger seem to never seem to hit URLSession:dataTask:didReceiveResponse:completionHandler:delegate: before hitting URLSession:dataTask:didReceiveData:delegate: in FLEXNetworkObserver.m

So given that the requestState.dataAccumulator is initialised at the former call here, it nil when we try to append the data to it here

  1. I can confirm that running the same codebase on iOS 14.x simulator calls both the methods in order and hence it has a non-nil requestState.dataAccumulator in order to write the data to. This applies to both calls made via Alamofire and otherwise.

Alamofire version: 4.8.2
FLEX version: 4.7.0

Not sure how much this info helps to debug this further. Happy to provide more info/debug further with your inputs.

commented

the latest version is OK.

Still seeing this issue on iOS 15 + FLEX version 4.7.0

@bolee Did you happen to change anything else around the timeline that this started to work for you?

Closing this as it seems to be an issue with Alamofire and not FLEX; feel free to keep discussing, though

commented

Thanks to @vijaytholpadi's comments above, I was able to workaround this issue with the changes in this commit:

gojekfarm@51b3bf7

I haven't raised an PR to this repo because I am not sure if this is a proper fix. It feels like a band aid to me. Mostly because I haven't dig deeper into why or how Alamofire/URLSession/iOS suddenly broke this functionality with iOS 15.

On the other hand it does unblock the devs in our org. We've been using this fork for the past 2 months now, and haven't faced any issues so far. So maybe other teams can also find this useful, hence sharing it here.
(Note: Fork is on top of v4.7.0 at the moment)

@NSExceptional do you think this change will be acceptable to merge into upstream? I can raise an MR accordingly.

Happy to merge it!