hello I am using google autocomplete Places in my IOS app. But the problem is its not working. and I am unable to get a current location of the user.
The search function is successfully showing places in autocomplete box but the only problem I am having is unable to get user's current location.This is the code for getting user current location I am using
class ViewController: UIViewController,CLLocationManagerDelegate {
var locationManager = CLLocationManager()
var placesClient : GMSPlacesClient?
override func viewDidLoad() {
super.viewDidLoad()
locationManager.requestAlwaysAuthorization()
run()
}
func run(){
self.placesClient?.currentPlaceWithCallback({ (list: GMSPlaceLikelihoodList?, error: NSError?) -> Void in
if let error = error {
print("error: \(error.description)")
return
}
for likelihood in list!.likelihoods {
if let likelihood = likelihood as? GMSPlaceLikelihood {
let place = likelihood.place
print("Current Place name \(place.name) at likelihood \(likelihood.likelihood)")
print("Current Place address \(place.formattedAddress)")
print("Current Place attributions \(place.attributions)")
print("Current PlaceID \(place.placeID)")
}
}
})
}
I have added keys in info.plist as well and I am compiling app on my phone.