Skip to content
This repository was archived by the owner on Jul 27, 2019. It is now read-only.
This repository was archived by the owner on Jul 27, 2019. It is now read-only.

Request sent with NSURLSession doesn't get recordet #5

@chrs1885

Description

@chrs1885

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

@IBAction func goButtonTapped(sender: AnyObject) {
    if let urlString = urlTextField.text, url = NSURL(string: urlString){
        browseWebView.loadRequest(NSURLRequest(URL: url))
    }
}

with

@IBAction func goButtonTapped(sender: AnyObject) {
    let request = NSMutableURLRequest(URL: NSURL(string: "http://www.google.com/")!)
    httpGet(request) {
        (resultString, error) -> Void in
        print(resultString)
    }
}

func httpGet(request: NSMutableURLRequest!, callback: (String,
    String?) -> Void) {
    let configuration =
        NSURLSessionConfiguration.defaultSessionConfiguration()
    let session = NSURLSession(configuration: configuration,
                               delegate: nil,
                               delegateQueue:NSOperationQueue.mainQueue())
    let task = session.dataTaskWithRequest(request){
        (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void in
        callback(response.debugDescription, error?.localizedDescription)
    }
    task.resume()
}

in the ViewController class of the demo project.

Any idea? Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions