user3744453
user3744453

Reputation:

Google map GMSMarker warning

I have integrated google map SDK in my iOS app. It gives following warning in debug area.

Marker set as selectedMarker while not belonging to this map. Ignoring.

If any one have idea then please share it.

Upvotes: 2

Views: 1073

Answers (2)

Nosov Pavel
Nosov Pavel

Reputation: 1571

The main reason is that you forget to set marker.map = mapView, the second and the most common reason for whom interacting with markers is that you return 'false' in
mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool , the documentation said:

return YES if this delegate handled the tap event, which prevents the map from performing its default selection behavior, and NO if the map should continue with its default selection behavior.

Upvotes: 0

christinehall
christinehall

Reputation: 21

Whenever you create a GMSMarker, you'll want to set its map property. Check out Google's documentation here. Swift example below, but the .map call is the same in Objective-C.

let position = CLLocationCoordinate2D(latitude: 10, longitude: 10)
let marker = GMSMarker(position: position)
marker.title = "Hello World"
marker.map = mapView

Line 4 is the key here. Failing to do that will throw the error you're seeing.

Upvotes: 2

Related Questions