Closed mthole-old closed 9 years ago
@viteinfinite, could you take a look?
See https://github.com/square/PonyDebugger/tree/mthole/NSURLSession-workaround for a potential -- lucky likely wrong -- fix.
Digging into this more: I think PonyDebugger is getting swizzled-callbacks for didReceiveData
multiple times for the same data task, due to the class hierarchy I'm working with? If I use forwardNetworkTrafficFromDelegateClass:
rather than forwardAllNetworkTraffic:
, things seem to work correctly. Hmm.
This issue was the result of over-eagerly-swizzling, causing and multiple notifications to be posted to the data accumulator. I'm not sure it's worth debugging that further, so I'll go ahead and close this issue. (I resolved my issue by switching to forwardNetworkTrafficFromDelegateClass:
, a more targeted approach.)
I've also been running into this issue. I'll post back if I find a solution. I'd like to continue using forwardAllNetworkTraffic:
.
When using an NSURLSession-based connection (e.g. AFNetworking 2.0), PonyDebugger is reporting invalid JSON response bodies. After a little investigation, I see that the JSON response body is actually double-logged, making it invalid JSON. (This prevents the Chrome tools built-in display of the JSON as an object, etc.)
I did a bit more digging and found that
[PDNetworkDomainController addAccumulatedData:forTask:]
is being called twice with the samedata
for the sametask
-- once in the "running" state and once in the "completed" state.I suspect this has to do with the recent-ish changes for support NSURLSession connections.