title: Keep getting http transport security error, even though i have added the code to bypass the security
body: <p>i have tried loads of different methods, normally the code i use works. However in this case im not sure if its to do with the code from the tutorial that i have used. They have used https instead of http. I have tried different methods im not sure what to do! any advice would be appreciated. </p>
  
  <pre><code> @IBAction func signinTapped(sender : UIButton) {
      let username:NSString = txtUsername.text!
      let password:NSString = txtPassword.text!
  
      if ( username.isEqualToString("") || password.isEqualToString("") ) {
  
          let alertView:UIAlertView = UIAlertView()
          alertView.title = "Sign in Failed!"
          alertView.message = "Please enter Username and Password"
          alertView.delegate = self
          alertView.addButtonWithTitle("OK")
          alertView.show()
      } else {
  
          do {
          let post:NSString = "username=\(username)&amp;password=\(password)"
  
          NSLog("PostData: %@",post);
              let url = NSURL(string:"http://")
  
          let postData:NSData = post.dataUsingEncoding(NSASCIIStringEncoding)!
  
          let postLength:NSString = String( postData.length )
  
          let request:NSMutableURLRequest = NSMutableURLRequest(URL: url!)
          request.HTTPMethod = "POST"
          request.HTTPBody = postData
          request.setValue(postLength as String, forHTTPHeaderField: "Content-Length")
          request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
          request.setValue("application/json", forHTTPHeaderField: "Accept")
  
  
          var reponseError: NSError?
          var response: NSURLResponse?
  
          var urlData: NSData?
          do {
              urlData = try NSURLConnection.sendSynchronousRequest(request, returningResponse:&amp;response)
          } catch let error as NSError {
              reponseError = error
              urlData = nil
          }
  
          if ( urlData != nil ) {
              let res = response as! NSHTTPURLResponse!;
  
              NSLog("Response code: %ld", res.statusCode);
  
              if (res.statusCode &gt;= 200 &amp;&amp; res.statusCode &lt; 300)
              {
                  let responseData:NSString  = NSString(data:urlData!, encoding:NSUTF8StringEncoding)!
  
                  NSLog("Response ==&gt; %@", responseData);
  
                  //var error: NSError?
  
                  let jsonData:NSDictionary = try NSJSONSerialization.JSONObjectWithData(urlData!, options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary
  
  
                  let success:NSInteger = jsonData.valueForKey("success") as! NSInteger
  
                  //[jsonData[@"success"] integerValue];
  
                  NSLog("Success: %ld", success);
  
                  if(success == 1)
                  {
                      NSLog("Login SUCCESS");
  
                      let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
                      prefs.setObject(username, forKey: "USERNAME")
                      prefs.setInteger(1, forKey: "ISLOGGEDIN")
                      prefs.synchronize()
  
                      self.dismissViewControllerAnimated(true, completion: nil)
                  } else {
                      var error_msg:NSString
  
                      if jsonData["error_message"] as? NSString != nil {
                          error_msg = jsonData["error_message"] as! NSString
                      } else {
                          error_msg = "Unknown Error"
                      }
                      let alertView:UIAlertView = UIAlertView()
                      alertView.title = "Sign in Failed!"
                      alertView.message = error_msg as String
                      alertView.delegate = self
                      alertView.addButtonWithTitle("OK")
                      alertView.show()
  
                  }
  
              } else {
                  let alertView:UIAlertView = UIAlertView()
                  alertView.title = "Sign in Failed!"
                  alertView.message = "Connection Failed"
                  alertView.delegate = self
                  alertView.addButtonWithTitle("OK")
                  alertView.show()
              }
          } else {
              let alertView:UIAlertView = UIAlertView()
              alertView.title = "Sign in Failed!"
              alertView.message = "Connection Failure"
              if let error = reponseError {
                  alertView.message = (error.localizedDescription)
              }
              alertView.delegate = self
              alertView.addButtonWithTitle("OK")
              alertView.show()
          }
          } catch {
              let alertView:UIAlertView = UIAlertView()
              alertView.title = "Sign in Failed!"
              alertView.message = "Server Error"
              alertView.delegate = self
              alertView.addButtonWithTitle("OK")
              alertView.show()
          }
      }
  
  }
  
  func textFieldShouldReturn(textField: UITextField) -&gt; Bool {   //delegate method
      textField.resignFirstResponder()
      return true
  }
  </code></pre>
  
  <p>}</p>