3

Im having an error while trying to animate a GMSMarker, I have followed the Google documentation and various guides but it keeps returning an error, below is my code:

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
}

Which returns the error Ambiguous use of 'kGMSMarkerAnimationPop'

Any help would be appriciated!

tobyapp
  • 179
  • 5
  • 12
  • Please check this: http://stackoverflow.com/questions/31309521/error-use-of-unresolved-identifier-kcgblendmodemultiply/, maybe it will give you some clues. – 0x416e746f6e Jan 07 '16 at 22:48

5 Answers5

6

upgrading google map pod won't work, at least until 1.12.3.

  1. change GMSMarkerAnimation in GMSMarker.h from this:

    typedef enum {
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } GMSMarkerAnimation;
    

    to this:

    typedef NS_ENUM(NSInteger, GMSMarkerAnimation){
      /** No animation (default). */
      kGMSMarkerAnimationNone = 0,
    
      /** The marker will pop from its groundAnchor when added. */
      kGMSMarkerAnimationPop,
    } ;
    
  2. change

    locationMarker.appearAnimation = kGMSMarkerAnimationPop

    to

    locationMarker.appearAnimation = GMSMarkerAnimation.Pop

Howard Liu
  • 189
  • 2
  • 8
  • just add: `locationMarker.appearAnimation = GMSMarkerAnimation.pop ` with lower case(`pop`)! – S At Aug 24 '17 at 12:38
4

In Swift 3/GoogleMaps 2.3.0. The new syntax is :

marker.appearAnimation = GMSMarkerAnimation.pop
GraSim
  • 3,830
  • 1
  • 29
  • 35
3

For me this happens when I upgrade from GoogleMap 1.10.3 to 1.11.1 using CocoaPod. Previously using 1.10.3 it requires me to import all of the header files of GoogleMap in Bridging-Header.h file.

To remove this ambiguous error, I just commented out all the imported headers in Bridging-Header.h

yonasstephen
  • 2,645
  • 4
  • 23
  • 48
2

I looked around and I found an answer that worked for me:

locationMarker.appearAnimation = GoogleMaps.kGMSMarkerAnimationPop
ZGski
  • 2,398
  • 1
  • 21
  • 34
0

Swift 3
marker.appearAnimation = kGMSMarkerAnimationpop

Swift 4

marker.appearAnimation = GMSMarkerAnimation.pop