Advertisement
Guest User

Untitled

a guest
Nov 16th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. class SignUp: UIViewController {
  2.  
  3. @IBOutlet weak var buttonNameTxt: UITextField!
  4. @IBOutlet weak var buttonEmailTxt: UITextField!
  5. @IBOutlet weak var buttonPwdTxt: UITextField!
  6.  
  7.  
  8. override func viewDidLoad() {
  9. super.viewDidLoad()
  10.  
  11. }
  12.  
  13. @IBAction func buttonSignIn(_ sender: UIButton){
  14.  
  15. let usermainname:NSString = buttonNameTxt.text! as NSString
  16. let username:NSString = buttonEmailTxt.text! as NSString
  17. let password:NSString = buttonPwdTxt.text! as NSString
  18.  
  19.  
  20. let myURL = NSURL(string: "https:\mev.com/api/login") //(адресс изменен, т.к. проект для работы)
  21. let request = NSMutableURLRequest(url: myURL as! URL)
  22. request.httpMethod = "Post"
  23.  
  24.  
  25. let postString = "name = (usermainname) email = (username) &passwod = (password) "
  26. request.httpBody = postString.data(using: String.Encoding.utf8)
  27.  
  28.  
  29. let task = URLSession.shared.dataTask(with: request as URLRequest) {
  30. data , response , error in
  31.  
  32. do {
  33.  
  34. let err: NSError?
  35. let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as? NSDictionary
  36.  
  37. print(json as Any)
  38.  
  39. if let parseJSON = json {
  40. let resultValue = parseJSON["status"] as? String
  41. print ("result:(resultValue)")
  42.  
  43. var isUserRegister:Bool = false
  44. if resultValue == "success" {isUserRegister = true}
  45.  
  46. var messageToDisplay:String = parseJSON["massage"] as! String
  47. if isUserRegister {
  48.  
  49. messageToDisplay = parseJSON["massage"] as! String
  50.  
  51. }
  52.  
  53.  
  54. }
  55.  
  56.  
  57. } catch {
  58.  
  59. print("error")
  60. }
  61.  
  62. 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
  63. 2016-11-16 12:37:16.328782 MevicsPromo[12011:692688] [MC] Reading from private effective user settings.
  64. 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 =
  65. "Result" => <int64: 0x61000002c100>: 29
  66. }
  67. 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 =
  68. "Dictionary" => <dictionary: 0x6080003576b0> { count = 1, transaction: 0, voucher = 0x0, contents =
  69. "ServerURL" => <dictionary: 0x608000357290> { count = 3, transaction: 0, voucher = 0x0, contents =
  70. "com.apple.CFURL.magic" => <uuid: 0x608000052060> C3853DCC-9776-4114-B6C1-FD9F51944A6D
  71. "com.apple.CFURL.string" => <string: 0x608000059d40> { length = 30, contents = "https:\mesu.apple.com/assets/" }
  72. "com.apple.CFURL.base" => <null: 0x10a307f20>: null-object
  73. }
  74. }
  75. "Result" => <int64: 0x608000229a20>: 0
  76. }
  77. 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement