Nativescript with Googlemap static api - iOS 上的问题

Nativescript with Googlemap static api - issue on iOS

我正在尝试在我的 Nativescript 应用程序中添加由 google 静态地图 api 生成的地图图像(我在 Vue 中使用 Nativescript)。 我可以让它在 Android 上运行,但我在 iOS.

上遇到一些问题

我只是有一个像这样的图像组件<Image :src="map_source" />

在我的 vue 数据中,我有 map_source: "https://maps.googleapis.com/maps/api/staticmap?&markers=48.2,2.1&path=color:red|weight:5|fillcolor:red|48.2,2.1|48.3,2.13|48.4,2.12&zoom=10&size=460x200&key=MY_API_KEY"

当我在浏览器中使用这个 URL 时,我得到了想要的地图。 当我在 Android 上的应用程序中使用此 URL 时,它会正确显示地图。 但是当我在 iOS 设备上的应用程序中使用相同的 URL 时,地图根本不显示。

注意:如果我删除路径(例如 map_source:“https://maps.googleapis.com/maps/api/staticmap?&markers=48.2,2.1&zoom=10&size=460x200&key=MY_API_KEY”,图像会在 Android 和 iOS 上正确显示。仅错误当我添加路径时出现。

这是 iOS 问题还是我做错了什么?

多亏了@Manoj,我才能够找到这个问题。在 iOS 设备上,URL 不受支持,因为“|”特点。所以我不得不这样编码:

let imageSourceModule = require("tns-core-modules/image-source");
let url = encodeURI("https://maps.googleapis.com/maps/api/staticmap?&markers=48.2,2.1&zoom=10&size=460x200&key=MY_API_KEY")
imageSourceModule.fromUrl(url).then(res => {
    this.map_source = res;
});