class SignUp: UIViewController { @IBOutlet weak var buttonNameTxt: UITextField! @IBOutlet weak var buttonEmailTxt: UITextField! @IBOutlet weak var buttonPwdTxt: UITextField! override func viewDidLoad() { super.viewDidLoad() } @IBAction func buttonSignIn(_ sender: UIButton){ let usermainname:NSString = buttonNameTxt.text! as NSString let username:NSString = buttonEmailTxt.text! as NSString let password:NSString = buttonPwdTxt.text! as NSString let myURL = NSURL(string: "https:\\mev.com/api/login") //(адресс изменен, т.к. проект для работы) let request = NSMutableURLRequest(url: myURL as! URL) request.httpMethod = "Post" let postString = "name = \(usermainname) email = \(username) &passwod = \(password) " request.httpBody = postString.data(using: String.Encoding.utf8) let task = URLSession.shared.dataTask(with: request as URLRequest) { data , response , error in do { let err: NSError? let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as? NSDictionary print(json as Any) if let parseJSON = json { let resultValue = parseJSON["status"] as? String print ("result:\(resultValue)") var isUserRegister:Bool = false if resultValue == "success" {isUserRegister = true} var messageToDisplay:String = parseJSON["massage"] as! String if isUserRegister { messageToDisplay = parseJSON["massage"] as! String } } } catch { print("error") } and here is the error
2016-11-16 12:37:16.328505 MevicsPromo[12011:692688] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/HardBuf/Library/Developer/CoreSimulator/Devices/E3B4C6A4-A49D-4363-89D5-31931EA513A8/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2016-11-16 12:37:16.328782 MevicsPromo[12011:692688] [MC] Reading from private effective user settings. 2016-11-16 12:37:18.276331 MevicsPromo[12011:692798] 0x60000014e4f0 Copy matching assets reply: XPC_TYPE_DICTIONARY <dictionary: 0x60000014e4f0> { count = 1, transaction: 0, voucher = 0x0, contents = "Result" => <int64: 0x61000002c100>: 29 } 2016-11-16 12:37:18.277030 MevicsPromo[12011:692798] 0x608000357b80 Daemon configuration query reply: XPC_TYPE_DICTIONARY <dictionary: 0x608000357b80> { count = 2, transaction: 0, voucher = 0x0, contents = "Dictionary" => <dictionary: 0x6080003576b0> { count = 1, transaction: 0, voucher = 0x0, contents = "ServerURL" => <dictionary: 0x608000357290> { count = 3, transaction: 0, voucher = 0x0, contents = "com.apple.CFURL.magic" => <uuid: 0x608000052060> C3853DCC-9776-4114-B6C1-FD9F51944A6D "com.apple.CFURL.string" => <string: 0x608000059d40> { length = 30, contents = "https:\\mesu.apple.com/assets/" } "com.apple.CFURL.base" => <null: 0x10a307f20>: null-object } } "Result" => <int64: 0x608000229a20>: 0 } 2016-11-16 12:37:18.277318 MevicsPromo[12011:692798] http:\\ru.stackoverflow.com/editing-help[MobileAssetError:29] Unable to copy asset information from https:\\mesu.apple.com/assets/ for asset type com.apple.MobileAsset.TextInput.SpellChecker
https:\\mev.com/api/login<- uh, backslashes? - D-side