无法将样式应用于 GMSMapView
Cannot apply style to GMSMapView
我的代码如下:
/* Map */
mapView = GMSMapView()
mapView.delegate = self
mapView.mapType = .normal
do {
// Set the map style by passing the URL of the local file.
if let styleURL = Bundle.main.url(forResource: "styles", withExtension: "json") {
mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
} else {
NSLog("Unable to find styles.json")
}
} catch {
NSLog("One or more of the map styles failed to load. \(error)")
}
我正在关注 this 关于如何自定义我的 Google 地图的教程。
以上是我实现styles.json文件的代码。我在我的构建包中添加了该文件,并且代码从未抛出关于无法解析我的 json 文件的异常。它根本没有将样式效果应用到我的地图上。
如有任何帮助,我们将不胜感激。我在里面慢慢地死去!!!
为未来任何人留下答案:
Google 地图样式不适用于韩国地图。它甚至适用于朝鲜,但不适用于韩国。韩国法律禁止将地图数据导出到国外数据中心。
:
Yes , Korea does not support some features offered by Google Map due to national law. Google Map Korea can not be export map data for data centers abroad or including the ability to dynamically change the map image. Many South Korea Maps and services are limited to the domestic uses and Google is striving to make this a better service. For more details here's the original answer in Korean: original reply from Google Maps Korea
我的代码如下:
/* Map */
mapView = GMSMapView()
mapView.delegate = self
mapView.mapType = .normal
do {
// Set the map style by passing the URL of the local file.
if let styleURL = Bundle.main.url(forResource: "styles", withExtension: "json") {
mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
} else {
NSLog("Unable to find styles.json")
}
} catch {
NSLog("One or more of the map styles failed to load. \(error)")
}
我正在关注 this 关于如何自定义我的 Google 地图的教程。
以上是我实现styles.json文件的代码。我在我的构建包中添加了该文件,并且代码从未抛出关于无法解析我的 json 文件的异常。它根本没有将样式效果应用到我的地图上。
如有任何帮助,我们将不胜感激。我在里面慢慢地死去!!!
为未来任何人留下答案:
Google 地图样式不适用于韩国地图。它甚至适用于朝鲜,但不适用于韩国。韩国法律禁止将地图数据导出到国外数据中心。
Yes , Korea does not support some features offered by Google Map due to national law. Google Map Korea can not be export map data for data centers abroad or including the ability to dynamically change the map image. Many South Korea Maps and services are limited to the domestic uses and Google is striving to make this a better service. For more details here's the original answer in Korean: original reply from Google Maps Korea