我在尝试为GMSMarker设置动画时出现错误,我遵循了Google文档和各种指南,但始终返回错误,以下是我的代码:

func placeMarker(coordinate: CLLocationCoordinate2D) {
    if locationMarker != nil {
        locationMarker.map = nil
    }

    locationMarker = GMSMarker(position: coordinate)
    locationMarker.icon = GMSMarker.markerImageWithColor(purple)
    locationMarker.appearAnimation = kGMSMarkerAnimationPop
    locationMarker.snippet = "The best place on earth."
    locationMarker.map = mapView
}

该错误返回错误使用'kGMSMarkerAnimationPop'

任何帮助都将被申请!

最佳答案

至少在1.12.3之前,升级Google Map Pod无效。

  • 将GMSMarker.h中的GMSMarkerAnimation更改为此:
    typedef enum {
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } GMSMarkerAnimation;
    

    对此:
    typedef NS_ENUM(NSInteger, GMSMarkerAnimation){
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } ;
    
  • 变化
    locationMarker.appearAnimation = kGMSMarkerAnimationPop

    locationMarker.appearAnimation = GMSMarkerAnimation.Pop
  • 09-11 17:36