Google Maps Javascript API Doesn't Respond to Touch Events in iOS 10

心不动则不痛 提交于 2020-01-12 08:05:32

问题


I run a website with a number of custom Google Maps built in (showing various locations on a map after a search or generating directions to/from a location). I use Google Maps Javascript API for this. My users have started reporting that on iOS 10, these maps no longer respond to touch events -- they cannot pinch-to-zoom nor can they click on the "pins" on the map to open the location info balloons.

I've been searching all over for others who have had this issue to no avail. I found one StackOverflow question here (http://webcache.googleusercontent.com/search?q=cache:DaiSdOgD0U4J:stackoverflow.com/questions/39401974/google-maps-javascript-doesnt-pan-or-zoom-in-ios-10+&cd=3&hl=en&ct=clnk&gl=us), but it was downvoted, then deleted. (Why?) A fresh search today still shows that page, but it leads to a 404, making a search even more frustrating.

Has anyone else experienced this? Is this a bug within the Google Maps API? I certainly can't find anything about that on their Developer website. Am I possibly doing something very wrong to lead to this? The code has worked for years and hasn't been modified in a few months now, so nothing changed on our end.

  • We do use an API key in our requests
  • I've tried switching from the current release version (3.25) to the current experimental version (3.26) with no changes in functionality.
  • Users report this happens in at least both Safari and Chrome on iOS 10

Just hoping someone can provide any insight at all on the issue.


回答1:


Ok here is how I did to fix this issue. As a reminder i'm using AngularJS via the Ionic framework. I was calling the map this way in my index.html :

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=PUT_YOUR_GOOGLE_API_KEY_HERE&signed_in=true"></script>

It seams like signed_in feature of google map is adding a layer on the map that is not letting the map getting the X,Y of your screen touch position.

I just replaced by false to disable the signed_in feature and its working like a charm

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=PUT_YOUR_GOOGLE_API_KEY_HERE&signed_in=false"></script>


来源:https://stackoverflow.com/questions/39540515/google-maps-javascript-api-doesnt-respond-to-touch-events-in-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!