NSInvalidArgumentException isKindOfClass [英] NSInvalidArgumentException isKindOfClass

查看:153
本文介绍了NSInvalidArgumentException isKindOfClass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我无法理解的问题,我正在使用一个图书馆来使用地图开源地图( https://github.com/route-me/route-me ),这个例子是完美的,我相信没有连接到代码的东西,我相信它是在组态。
发生什么事情是,如果我进行以下调用:

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];

我收到一条错误,表示UIView类没有方法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] 由于未捕获异常终止应用程序NSInvalidArgumentException,reason:' - [UIView markerManager]:无法识别的选择器发送到实例0x1d88fbb0' *

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'*

没有任何内容,请参阅有效性,ocódigofunciona perfeitamente:

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.

注意:RMMarkerManager类继承自UIView。

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.

我的.xib始终配置和引用所有内容。

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

我不明白为什么这更多是我的解决方案。

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

: - /

推荐答案

如果您使用了故事板,那么您需要将您的视图中的自定义类(在身份检查器面板中)设置为RMMapView。否则,故事板不知道要为您的观点实例化哪个类。

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.

这篇关于NSInvalidArgumentException isKindOfClass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆