title: Json Error EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
body: <p>dears </p>
  
  <p>i am using this code </p>
  
  <pre><code>var Locations = [LocationListStats]()
  
  func downloadJSON(completed: @escaping () -&gt; ()) {
  
      let url = URL(string: "http://teslm.net/app/LocationList.php")
  
      URLSession.shared.dataTask(with: url!) { (data, response, error) in
          do {
              self.Locations = try JSONDecoder().decode([LocationListStats].self, from: data!)        
              DispatchQueue.main.async {
                  completed()
              }
          }catch {
              print("JSON Error")
          }
      }.resume()
  }
  </code></pre>
  
  <p>but i am getting this error : EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</p>
  
  <p>but if i use other URL it working without any error. 
  so do you think i have issue with my code here or i should do something with my Json file at back end ? </p>
  
  <p>error here in this line:</p>
  
  <pre><code>self.Locations = try JSONDecoder().decode([LocationListStats].self, from: data!)
  </code></pre>
  
  <p>if i print the error it give me this:</p>
  
  <blockquote>
    <p>The resource could not be loaded because the App Transport Security policy requires the use of a secure connection</p>
  </blockquote>
  
  <p>i used this in my plist file to try to solve this issue but same thing:</p>
  
  <pre><code>    &lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
  &lt;dict&gt;
      &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;NSExceptionDomains&lt;/key&gt;
      &lt;dict&gt;
          &lt;key&gt;http://teslm.net/app/LocationList.php&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
              &lt;true/&gt;
              &lt;key&gt;NSThirdPartyExceptionRequiresForwardSecrecy&lt;/key&gt;
              &lt;true/&gt;
          &lt;/dict&gt;
      &lt;/dict&gt;
  &lt;/dict&gt;
  </code></pre>
  
  <p>i think this issue is related to HTTPS protocol am i right ?</p>