swift 3 urlRequest session.dataTask not firing
<p>I am trying to get stock quotes from Yahoo using Swift 3. Although there are some decent tutorials on Swift 2, none of them seem to translate well to Swift 3.</p>

<p>The issue I have at the moment is that in the code below, the session.dataTask is never called. The print statement never fires and the rest of the code that is in there does not work.</p>

<p>I have checked that the request variable looks good, and the url has been tested on the yahoo developer site.</p>

<p>So I'm thinking I must have the syntax of the dataTask wrong or has an error so is skipping completely.</p>

<p>Any thoughts?</p>

<pre><code>    urlString = "http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol IN ('APL')"

        //let urlNSS : NSString = urlString as NSString
        let urlStr : String = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
        let url : URL = URL(string: urlStr as String)!
        let request = URLRequest(url: url)
        let session = URLSession.shared
        let config = URLSessionConfiguration.default

        let task = session.dataTask(with: request, completionHandler: {(data, response, error) -&gt; Void in

            print("in the task")

            ..
            ..
        )}

task.resume()
</code></pre>

<p>If I inspect task I see the following
<a href="https://i.stack.imgur.com/l7zTG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l7zTG.png" alt="enter image description here"></a></p>