kasketis / netfox

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
MIT License
3.65k stars 368 forks source link

can't catch custom Session when set URLSessionConfiguration protocolClasses #238

Open Hflydragon opened 2 years ago

Hflydragon commented 2 years ago

Describe the bug when i used custom Session, set protocolClasses, it doesn't work.

Hflydragon commented 2 years ago

here config.protocolClasses something errors use? why not use protocolClasses_Swizzled

`@objc private class var default_swizzled: URLSessionConfiguration { get { let config = URLSessionConfiguration.default_swizzled

        // Let's go ahead and add in NFXProtocol, since it's safe to do so.
        config.protocolClasses?.insert(NFXProtocol.self, at: 0)

        return config
    }
}

@objc private class var ephemeral_swizzled: URLSessionConfiguration {
    get {
        let config = URLSessionConfiguration.ephemeral_swizzled

        // Let's go ahead and add in NFXProtocol, since it's safe to do so.
        config.protocolClasses?.insert(NFXProtocol.self, at: 0)

        return config
    }
}`