【问题标题】:Swift Error - use of unresolved identifier 'kGMSMarkerAnimationPop'Swift 错误 - 使用未解析的标识符“kGMSMarkerAnimationPop”
【发布时间】:2017-03-28 06:47:56
【问题描述】:

我收到了这个错误

使用未解析的标识符“kGMSMarkerAnimationPop”

当我在 Swift 3 中使用以下代码时:

let camera = GMSCameraPosition.camera(withLatitude: location.coordinate.latitude, longitude: location.coordinate.longitude, zoom: 14)
mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView?.isMyLocationEnabled = true
mapView?.settings.myLocationButton = true
view = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
marker.title = "Sydney"
marker.snippet = "Australia"
marker.appearAnimation = kGMSMarkerAnimationPop // the error is occurring in this line
marker.map = mapView
locationManager.stopUpdatingLocation()

我该如何解决?

【问题讨论】:

标签: ios google-maps swift3 xcode8 gmsmapview


【解决方案1】:

在 Swift 3/4 和 GoogleMaps 2.3.0 中。 新语法是:

marker.appearAnimation = GMSMarkerAnimation.pop

Ambiguous use of 'kGMSMarkerAnimationPop' Error in Swift 2

【讨论】:

    【解决方案2】:

    试试 marker.appearAnimation = .pop

    【讨论】:

      猜你喜欢
      • 2016-04-29
      • 1970-01-01
      • 2017-02-10
      • 1970-01-01
      • 2015-05-13
      • 2016-11-28
      • 2015-05-25
      • 2017-01-28
      • 2015-11-27
      相关资源
      最近更新 更多