【发布时间】:2017-09-21 05:09:13
【问题描述】:
我的代码如下:
/* 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 文件的异常。它根本不会将样式效果应用到我的地图上。
任何帮助将不胜感激。我在里面慢慢死去!!!
【问题讨论】:
-
您的链接无效,请检查捆绑资源中的 .json 文件是否可用,否则可以附加您的项目
-
修复了链接!但我找到了解决方案
-
问题是 Google 地图样式不适用于韩国领土。伤心!
标签: ios google-maps gmsmapview