Всем привет! У меня при тестировании формы регистрации возникает вот такая ошибка:
2016-05-14 18:03:36.852 QaaP[25045:764432] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. error=Optional(Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7f99f0724900 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://192.168.1.5/userRegister.php, NSErrorFailingURLKey=http://192.168.1.5/userRegister.php, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.})
Код выглядит следующем образом:
let url = NSURL(string: "http://192.168.1.5/userRegister.php")
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "POST"
let posting = "email=\(userEmail)&password=\(userPassword)"
request.HTTPBody = posting.dataUsingEncoding(NSUTF8StringEncoding)
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
data, response, error in
if error != nil
{
print("error=\(error)")
return
}
do {
let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers) as? NSDictionary
if let parseJSON = json {
var resultValue = parseJSON["status"] as? String
print("result: \(resultValue)")
var userRegistered:Bool = false;
if(resultValue == "Success") { userRegistered = true }
var messageToDisplay:String = parseJSON["message"] as! String!
if(!userRegistered)
{
messageToDisplay = parseJSON["message"] as! String!
}
dispatch_async(dispatch_get_main_queue(),{
var myAlert = UIAlertController(title: "Внимание", message: messageToDisplay, preferredStyle: .Alert)
let okAction = UIAlertAction(title: "Хорошо", style: .Default, handler: nil)
myAlert.addAction(okAction)
self.presentViewController(myAlert, animated: true, completion: nil)
})
}
}
catch {
print(error)
}
}
task.resume()
в чем проблема почему он не может получить данные , в plist может что добавить ?