0

I have a GMSMapView with a lot of markers, every marker represents one store of my client, every time the user approaches to one of the markers (to one of the stores) he gets a notification with the address of the store.

I want that when the user taps on a notification (opens the app via notification) the marker will be presented on the map (already selected).

Note: the marker is a property for every Store object, the UILocalNotification stores the Store object's identifier and that's how I find the correct store.

Note 2: I'm working with Google Maps iOS SDK.

I've tried to do it like this:

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{   
    NSString *storeIdentifier=[[notification userInfo] objectForKey:@"storeIdentifier"];
    Store *notificationsStore=[self.monitorLocationVC storeForIdentifier:storeIdentifier];

    [self.myVC mapView:self.myVC.mapView didTapMarker:notificationsStore.marker];
}

For some reason, the marker isn't being selected when the user opens the app.

I've override mapView: didTapMarker: on myVC.m like that:

-(BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker
{
    return NO;
}
abhi
  • 1,644
  • 1
  • 18
  • 33
FS.O
  • 393
  • 3
  • 22

2 Answers2

0

didTapMarker is on GMSMapViewDelegate, it's called by the map to notify your code that the marker has been tapped. It doesn't tap the marker.

You can however set selectedMarker on the map view, to cause that marker to be selected, and to show its info window (if it has one). For example:

self.myVC.mapView.selectedMarker = notificationsStore.marker;

See here for more examples: How to show a Info window in iOS Google maps without tapping on Marker?

Community
  • 1
  • 1
Saxon Druce
  • 16,868
  • 5
  • 45
  • 69
0
 -(BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker
  {
      viewIwant.hidden=NO;
     //or any nib you want 
      return YES;
  }
Pancho
  • 3,951
  • 1
  • 19
  • 32
sandeep nag
  • 148
  • 8