-
Notifications
You must be signed in to change notification settings - Fork 48
Request sent with NSURLSession doesn't get recordet #5
Comments
BTW, here's my setup code: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if let sharedRecorder = SWHttpTrafficRecorder.sharedRecorder() {
sharedRecorder.recordingFormat = SWHTTPTrafficRecordingFormat.BodyOnly
sharedRecorder.progressDelegate = self
let paths = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true) as [String]
try! sharedRecorder.startRecordingAtPath(paths[0], forSessionConfiguration: NSURLSessionConfiguration.defaultSessionConfiguration())
}
return true
} I'm currently using 1.0.1 of your library. Thank you! |
|
We should consider carefully swizzling NSURLSession to enable recording of all |
Hi, thank you for the info. you are right about the default session configuration. didn't check the docs and the naming was a bit missleading. unfortunately, I can't access the session configuration, since I'm trying to record the traffic produced by several 3rd party libraries (they don't expose the config instances). swizzling NSURLSession sounds like a valid option for my usecase and is still better than forking 3 repos just to expose the config. |
@chrs1885 You convinced me. One way to fix this is to change the implementation for 'SWHttpTrafficRecorder.sharedRecorder().startRecording()' to swizzle NSURLSession to enable recording of all NSURLSessions as suggested by @Ashton-W previously. And still keep the other interface with session configuration as one of the parameters so that users can control to record one particular session when needed. With this said, I am on some other projects now and may not get time to implement this recently. Is it something you are willing to take on and submit a PR? |
It would be really useful if you could implement this. I'm not too sure on what you mean by 'swizzle'. I'm having the same issue as OP where I don't have access to the session configuration. |
Hi,
I'm currently trying out your demo project. While this is working without any problem, requests sent with NSURLSession don't get recorded. To get a repro, simply replace
with
in the
ViewController
class of the demo project.Any idea? Thanks for your help.
The text was updated successfully, but these errors were encountered: