在swift 2中设置Google地图的样式

在swift 2中设置Google地图的样式,swift,google-maps,Swift,Google Maps,我面临一个小问题,我希望有一个简单的解决办法。 事实上,我想定制我的谷歌地图,但我只在Swift 3中找到了如何实现这一点(如以下说明),但我目前正在Swift 2中开发 do { // Set the map style by passing the URL of the local file. if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") { mapView.map

我面临一个小问题,我希望有一个简单的解决办法。 事实上,我想定制我的谷歌地图,但我只在Swift 3中找到了如何实现这一点(如以下说明),但我目前正在Swift 2中开发

do {
  // Set the map style by passing the URL of the local file.
  if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
    mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
  } else {
    NSLog("Unable to find style.json")
  }
} catch {
  NSLog("One or more of the map styles failed to load. \(error)")
}
有人知道如何在Swift 2中解决我的问题吗


谢谢你的回答

你需要什么样的样式?我只需要一个灰色/银色的样式,就像谷歌地图样式向导工具中的基本样式一样。你需要将代码从Swift 3迁移到Swift 2。它们没有太大区别。尝试使用Swift 2编译器编译您的代码并修复它输出的错误。我想这样做,但在Swift 2中找不到任何与GMSMapStyle对象等效的对象。我没有遇到任何相机的问题,但这里很奇怪。