I am trying to use google maps in my app but when trying to run the simulator it works only on the iPhone 6s plus simulator but not on anything else. I tried testing it on my actual phone, iPhone 5s, and it still does not work.
Ive made sure google places api, maps sdk, and also google places api web service(not sure why but it seems i need this one enabled also, would any of these interfere with one another?) are all enabled.
@IBOutlet weak var mapViewContainer: UIView!
var googleMapView: GMSMapView!
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.requestAlwaysAuthorization()
self.locationManager.requestWhenInUseAuthorization()
if CLLocationManager.locationServicesEnabled() {
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.startMonitoringSignificantLocationChanges()
}
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.googleMapView = GMSMapView(frame: self.mapViewContainer.frame)
self.googleMapView.animateToZoom(15.0)
self.view.addSubview(self.googleMapView)
self.googleMapView.layoutIfNeeded()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location:CLLocationCoordinate2D = manager.location!.coordinate
let marker = GMSMarker(position: location)
marker.title = "I'm here!"
marker.map = self.googleMapView
self.googleMapView.animateToLocation(location)
}
Also, I do receive an error consisting of the "ClientParametersRequest" then it counts down from 7; however that does not seem to affect my code, as I do get all the data i wants from the google maps and google places API's. I do not know though if it affects the maps at all?