I am using the following source code to retrieve some data from Google Maps:
import UIKit
import GoogleMaps
import GooglePlaces
import SwiftyJSON
class Place /*: NSObject*/ {
let name: String
init(diction:[String : Any])
{
let json = JSON(diction)
name = json["name"].stringValue //as! String
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var urlString = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?&location=54.507514,-0.073603&radius=1000&name=Specsavers&name=Opticians&key=AIzaSyAcXLd8jotAyIOgKYqhYbL703BIibXkd-M"
guard let url = URL(string: urlString) else {return}
URLSession.shared.dataTask(with: url) {(data, response, error) in
if let content = data {
do {
let json = try JSONSerialization.jsonObject(with: content, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
if let results = json["results"] as? [[String : Any]] {
var places = [Place]()
for place in results {
print("HERE0: " place)
places.append(Place(diction: place))
}
print("HERE1:", places)
}
else {
print("return")
}
}
catch{
}
}
}.resume()
}
But when I try to print places then I get the following response:
2017-11-13 11:16:56.887909+0000 Trial[3911:127944] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1757 received sct extension length is less than sct data length
and I get this output from HERE1:
HERE1: [Trial.Place] (My xcode project is named Trial)
while from HERE0 I get properly the json file as it is.
Why I cannot retrieve properly the name of the store from Google Places?