NSURLSession.dataTaskWithRequest is not working
<p>I am trying to make a generic class that will read JSON data from a URL a execute a callback with the NSDictionary created from the JSON data.
I have create a static class to do that function, but it seems that it does not work after dataTaskWithRequest. </p>

<p>[My Code]</p>

<pre><code>import Foundation

class LoadJsonFromNetwork {
    static func LoadJsonFromNetwork(url:NSURL, completion:((NSDictionary) -&gt; ())) {
        print("Creating request")
        let urlRequest = NSMutableURLRequest(URL: url, cachePolicy: .ReloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 15.0)
        print("Creating session")
        let session = NSURLSession.sharedSession()
        print("Send request")
        session.dataTaskWithRequest(urlRequest) {
            (data: NSData?, response: NSURLResponse?, error: NSError?) in
            print("Checking error and nil data")
            if (error == nil &amp;&amp; data != nil) {
                print("Request json dictionary from nsdata")
                if let result = self.NSDataToJson(data!) {
                    print("Dispatching to main queue")
                    dispatch_async(dispatch_get_main_queue()) {
                        print("Calling callback")
                        completion(result)
                    }
                }
            } else {
                print(error!.description)
            }
        }
    }

    private static func NSDataToJson(data:NSData) -&gt; NSDictionary? {
        do {
            print("Serializing JSON")
            let json: AnyObject? = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments)
            print("Cretaing NSDictionary")
            let result = json as? NSDictionary
            print("Returning result")
            return result
        } catch {
            return nil
        }
    }
}
</code></pre>

<p>[My Result in Console]</p>

<pre><code>Creating request
Creating session
Send request
</code></pre>