Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. let URL = Foundation.URL(string: "http:....")!
  2. let mutableURLRequest = NSMutableURLRequest(url: URL)
  3. mutableURLRequest.httpMethod = "POST"
  4.  
  5. let parameters = ["UserName": "Teste"]
  6. do{
  7. mutableURLRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: JSONSerialization.WritingOptions())
  8. }catch{}
  9.  
  10. mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
  11.  
  12. Alamofire.request("https").responseJSON{response in....}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement