I have a subclass of GMSMarker
called customMarker
.
My user gets notifications every time he approaches one of the markers on the map.
I want that when the user clicks on a notification, the marker will be already selected (when the app opens from the notification) adn its infoWindow will be visible.
I try to do it like this:
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
AroundersViewController *aroundersVC=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"aroundersPage"];
NSString *markerIdentifier=[[notification userInfo] objectForKey:@"markerIdentifier"];
CustomMarker *notificationsMarker=[self.monitorLocationVC markerForIdentifier:markerIdentifier];
[aroundersVC mapView:aroundersVC.mapView didTapMarker: notificationsMarker]; //App crashes here
}
But the app crashes with this error log message:
2016-02-11 20:39:30.355 App[15887:4216691] -[AroundersViewController mapView:didTapMarker:]: unrecognized selector sent to instance 0x7fa01bcf5890
2016-02-11 20:39:30.365 App[15887:4216691] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AroundersViewController mapView:didTapMarker:]: unrecognized selector sent to instance 0x7fa01bcf5890'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105257e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104cd0deb objc_exception_throw + 48
2 CoreFoundation 0x000000010526048d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001051ad727 ___forwarding___ + 487
4 CoreFoundation 0x00000001051ad4b8 _CF_forwarding_prep_0 + 120
5 App 0x0000000101988dab -[AppDelegate application:didReceiveLocalNotification:] + 523
6 UIKit 0x000000010561cdc5 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 3650
7 UIKit 0x0000000105622cc1 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 214
8 UIKit 0x0000000105622b95 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 508
9 UIKit 0x0000000105602007 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 159
10 UIKit 0x0000000105601c94 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 843
11 FrontBoardServices 0x0000000108027754 -[FBSSerialQueue _performNext] + 192
12 FrontBoardServices 0x0000000108027ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x0000000105183a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010517995c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x0000000105178e13 __CFRunLoopRun + 867
16 CoreFoundation 0x0000000105178828 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000107e53ad2 GSEventRunModal + 161
18 UIKit 0x0000000105604610 UIApplicationMain + 171
19 App 0x000000010199fd7f main + 111
20 libdyld.dylib 0x0000000106c7f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Does anybody have an idea?
Thanks!