square / PonyDebugger

Remote network and data debugging for your native iOS app using Chrome Developer Tools
Other
5.87k stars 595 forks source link

Fixing iOS 14 crash due to change in __NSCFURLSessionConnection imple… #214

Closed harleyjcooper closed 3 years ago

harleyjcooper commented 3 years ago

There have been verified reports of PonyDebugger crashing in iOS 14. The visibility of __NSCFURLSessionConnection's _task property was changed, so we need to dig deeper to access it, so rather than redeclaring the property as before, we now access it via [self valueForKey:@"_task"] in the methods themselves.

Creating a new property adds other issues, as it breaks the swizzling code, which validates that everything is both PD_-prefixed and exists in the original class minus the PD_. On that note, I fixed a typo in the swizzling code.

This change also works in iOS 13, so I made the changes in the iOS 13 swizzling, rather than have yet another iOS version's worth of swizzles.