kean / Pulse

Network logger for Apple platforms
https://pulselogger.com
MIT License
6.18k stars 294 forks source link

fix recursive call of pulse_init when another framework tries to swizzle URLSession.init #258

Closed FirExpl closed 2 months ago

FirExpl commented 2 months ago

The problem:

My app crashes after updating to a new version that contains AppLovin + Mintegral. The crash happens because pulse_init calls themself recursively until stack is overflowed

In my specific case, steps to reproduce the issue: 1) Install a version of your app with Pulse but without AppLovin + Mintegral 2) Start your app 3) Update to a version that contains Pulse and AppLovin + Mintegral 4) Got a crash on an app startup

Most likely Mintegral is modifying URLSession.init(configuration:delegate:delegateQueue:) themself that leads to this strange behavior

The solution:

Move the original implementation of URLSession.init(configuration:delegate:delegateQueue:) to a separate function and avoid using "recursive" calls in pulse_init method