-1

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?

5s

enter image description here

lifewithelliott
  • 1,012
  • 2
  • 16
  • 35
  • *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a [mcve].* Please [edit] your question to include enough code for others to see what is happening. – BSMP Jan 20 '16 at 19:28
  • made edits as requested – lifewithelliott Jan 20 '16 at 19:36
  • Tried creating another Xcode project, just copied all the code, did everything the same, but now the 6/6s simulator is crystal clear without problems on the 6/6s BUT still does not work on the 5/5s simulator? – lifewithelliott Jan 21 '16 at 17:35
  • agh, after resetting contents of the device in the simulator, now the 6s plus doesn't work :( – lifewithelliott Jan 23 '16 at 19:49

1 Answers1

0

While learning how to operate and implement google maps into my iOS Project, everywhere I had searched online I had read that the type of API Key I should be using is the server key, the iOS key seemed to not be working initially resulting in many errors.

And my application had worked out fine in Xcode, being able to run the program until several days ago which seemed very odd. Just now attempted to try the iOS Key and now works flawlessly within Xcode.

So the Answer is to use the iOS Key and it will allow maps to appear on all devices.

lifewithelliott
  • 1,012
  • 2
  • 16
  • 35