title: Swift 4 using URLSession with non-secure URL
body: <p>I'm trying to send data to a WebAPI service that uses HTTP and not HTTPS, however I get the following error:</p>
  
  <p><em>"Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value"</em></p>
  
  <p>Here is my code:</p>
  
  <pre><code>func logSample(emailSKU:String) -&gt; String {
      //let myAPI = "https://itunes.apple.com/us/rss/topmovies/limit=25/json"
      let myAPI = "http://&lt;myURlHere&gt;/api/xxx"
      let url = URL(string: myAPI)
      let session = URLSession.shared.dataTask(with: (url)!) { (data, response, error) in   &lt;====== Breaks on this line
  
      print("Response was:")
      print(response)
   }
      session.resume()
      return "return something here"
  }
  </code></pre>
  
  <p>The API service works just fine from other applications.
  If I use the iTunes url above, then everything works fine, so the only difference is the HTTP ver HTTPS.</p>
  
  <p>I have added 'Allow Arbitrary Loads' declaration to the plist, any ideas? </p>