Google Map Polyline无法显示并抛出错误

时间:2018-09-21 10:15:40

标签: javascript typescript google-maps-api-3 ionic3

我有Ionic 3应用程序,并将其更新为IONIC 4。因此,当我使用适用于iOS 12的xcode 10编译应用程序时,谷歌地图折线不会呈现并抛出错误。对于IONIC 3和ios 11.3,它的渲染效果非常好,但是在更新后,它不再显示: 我的代码是:

for (const path of dashedlinePaths) {

  const lineSymbol = {
    path: 'M 0,-1 0,1',
    strokeOpacity: 1,
    scale: 4
  };

  let dashedPath = new google.maps.Polyline({
    path: path,
    geodesic: true,
    strokeOpacity: 0,
    strokeColor: '#ff883c',
    icons: [{
      icon: lineSymbol,
      offset: '0',
      repeat: '20px'
    }]
  });

  dashedPath.setMap(this.googleMap);
}

for (const path of linePaths) {

  let linePath = new google.maps.Polyline({
    path: path,
    geodesic: true,
    strokeColor: '#ff883c',
    strokeOpacity: 1.0,
    strokeWeight: 4
  });

  linePath.setMap(this.googleMap);
}

错误显示如下:

TypeError: null is not an object (evaluating 'e.lineJoin="round"')
runTask — polyfills.js:3880
invokeTask — polyfills.js:4017
n — polyfills.js:3457
runTask — polyfills.js:3880

它还显示警告,如:

Total canvas memory use exceeds the maximum limit (224 MB).lW — poly.js:52:321

此外,当我尝试缩放地图时出现错误:

TypeError: null is not an object (evaluating 'a.scale')
runTask — polyfills.js:3880
invokeTask — polyfills.js:4017
n — polyfills.js:3457
runTask — polyfills.js:3880

1 个答案:

答案 0 :(得分:1)

这是iOS Safari上的Google Maps JS SDK中的错误。

已被Google确认,这是为此创建的两张票,一张甚至包含一个提琴,解释了如何复制它。

https://issuetracker.google.com/issues/119875119

https://issuetracker.google.com/issues/115289894