1

I'm running into a very strange bug which causes the GMSCamera of the GMSMapView to appear off center. I have a view controller in storyboard with a GMSMapView. In the center of the map view I have an image view that is pinned to line up with the camera target at all times(this functionality is similar to the Lyft app where you pan the map around a pin and it geocodes the coordinate for your pickup location). 90% of the time when I call camera.target and get the current coordinate of the camera, I get the expected result of whichever coordinate is currently in the center of the screen. However, if I logout of my app and log back in, when the map is presented it appears as if the camera is off screen. It geocodes coordinates that are not even in view. I thought that maybe the map was growing in size randomly, but it has auto layout constraints that keep it pinned to the edges of its superview. So I don't think it has to do with that. When this bug is present, I can go to another screen and come back and the bug is gone. At this point I'm just unsure how the camera could ever become uncentered. Sorry for the wall of text, but any help is greatly appreciated.

Update: I just double checked which versions of iOS this occurs on, and I can only seem to reproduce it on iOS 7. iOS 8 works as expected. Also, here's a photo so you can see what's going on(it's a bit difficult to describe so hopefully an image helps better than my description):enter image description here

As you can see, the map is centered on a locale called Mt. Adams. However, when I ask the camera what its target is, it returns a coordinate that is towards the top left corner of the screen, under the navigation bar. If I zoom all the way and this bug is present, the distance between the center of the map viewport and the camera target will become much greater.

mike
  • 1,441
  • 2
  • 19
  • 31
  • 1
    Any chance this is the same issue as: https://code.google.com/p/gmaps-api-issues/issues/detail?id=6876? Reported quite a long time ago to Google, still not fixed in 1.9.1. If it's the same issue, please vote there, so it would hopefully attract more attention from Google – Stanislav Dvoychenko Nov 18 '14 at 23:17
  • That does indeed seem to be the same issue. I reverted back to version 1.5(which of course broke other things because the API was different then) and the camera bug is gone. I voted for the issue so hopefully Google takes notice soon. Thanks! – mike Nov 18 '14 at 23:58
  • Hi Mike Could you please update your code as well. – Daljeet Nov 20 '14 at 20:19
  • Did you ever find out why? This is driving me nuts! – bogardon Sep 25 '18 at 08:46

0 Answers0