Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let url=URL(string:"http://........................")
- let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
- if error != nil {
- print(error)
- }
- else
- {
- do
- {
- let infoJson = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
- if let jsonData = infoJson["data"] as? NSDictionary
- {
- self.lblAddress.text=jsonData["address"]! as? String
- self.lblSobstvennik.text=jsonData["consumername"]! as? String
- } else {
- }
- }
- catch let error {
- print(error.localizedDescription)
- }
- }
- }
- task.resume()
- let url=URL(string:"http://........................")
- let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
- if error != nil {
- print(error)
- }
- else
- {
- do
- {
- let infoJson = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
- if let jsonData = infoJson["data"] as? NSDictionary
- {
- DispatchQueue.main.async(execute: {
- self.lblAddress.text=jsonData["address"]! as? String
- self.lblSobstvennik.text=jsonData["consumername"]! as? String
- })
- } else {
- }
- }
- catch let error {
- print(error.localizedDescription)
- }
- }
- }
- task.resume()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement