Vote count: 0
var Request=URLRequest(url:URL(string:"http://ift.tt/2kJE1NQ")!)
let session = URLSession.shared
Request.httpMethod = "POST"
let path = Bundle.main.path(forResource: "DataDriver", ofType: "json")
let data = try! NSData(contentsOfFile: path!, options: .dataReadingMapped)
let stringData = NSString(data: data as Data, encoding: String.Encoding.utf8.rawValue)
print(data)
Request.addValue("application/json", forHTTPHeaderField: "Content-Type")
Request.addValue("application/json", forHTTPHeaderField: "ACCEPT")
Request.addValue(Bundle.main.bundleIdentifier!, forHTTPHeaderField: "com.RamiDry.GeolocationMap")
let task = session.dataTask(with: Request) { (data, response, error) in
print(data!)
do{
let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments)
print(json)
}
catch let error{
print(error)
}
}
task.resume()
}
asked 21 secs ago
how to display response geolocation in google maps swift 3
Aucun commentaire:
Enregistrer un commentaire