0

I have a problem that I could not understand, I'm using a library for the use of Map Open Source Map (https://github.com/route-me/route-me), the example works perfectly, and I believe not to be something connected to the code , I believe it is something in the configuration. Well what happens is that if I make the following call:

RMMarkerManager *markerManager = [mapView markerManager];

I get an error that says the UIView class does not have the method markerManager:

2013-08-05 17:18:33.573 MapOffline[1310:907] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView markerManager]: unrecognized selector sent to instance 0x1d88fbb0'*

No entanto, se eu adicionar a validação, o código funciona perfeitamente:

if ([mapView isKindOfClass:[RMMapView class]]) {
    RMMarkerManager *markerManager = [mapView markerManager];
}

The sample project does not have this validation and works, someone could tell me what can be? It is not good practice validate whenever you use methods of this class.

Note: The RMMarkerManager class inherits from UIView.


What happened in my case was that I was not making reference to some images that were being used by the project the in example. I honestly do not know what that has to do one thing with another, more after adding the images in the project, everything worked perfectly. I guarantee that I have made no other changes.

My .xib always configured and referenced everything as it should.

I'm not understanding why this, more this was my solution.

:-/

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
  • 1
    how did you set up your mapView? programmatically (in code) or via a xib or storyboard file? – Michael Dautermann Aug 05 '13 at 20:43
  • If you used a storyboard then you need to set the "custom class" (in the identity inspector panel) of your view to be RMMapView. Otherwise the storyboard doesn't know which class to instantiate for your view. – Nicholas Hart Aug 05 '13 at 20:46
  • yep... that's the answer I was aiming to say, if Bolivar ever follows up to my comment. Since it's on your mind too, I'll let you make it official down below. – Michael Dautermann Aug 05 '13 at 20:47
  • This seems to be one of the most common problems people have with storyboards and XIBs... – Nicholas Hart Aug 05 '13 at 20:56
  • Gentlemen, my xib is properly configured.... Note that the code recognizes the class when I add validation. Anyway, it executes the code within the validation.... Notice also that the project is composed of a sub project, which is contained class RMMarkerManager. It will not be necessary any other configuration? – Bolivar Amâncio Aug 06 '13 at 11:46

1 Answers1

1

If you used a storyboard then you need to set the "custom class" (in the identity inspector panel) of your view to be RMMapView. Otherwise the storyboard doesn't know which class to instantiate for your view.

example of setting custom class

Nicholas Hart
  • 1,734
  • 13
  • 22
  • Gentlemen, my xib is properly configured.... Note that the code recognizes the class when I add validation. Anyway, it executes the code within the validation.... Notice also that the project is composed of a sub project, which is contained class RMMarkerManager. It will not be necessary any other configuration? – Bolivar Amâncio Aug 06 '13 at 11:51
  • I wonder if you need to add -ObjC and -all_load to your "other linker flags" in your project settings. – Nicholas Hart Aug 06 '13 at 21:39