unrecognized selector sent to instance&&Auto property synthesis will not synthesize property

程序运行崩溃 :'NSInvalidArgumentException', reason: '-[MyAnnotation setCoordinate:]: unrecognized selector sent to instance

产生了一个警告: Auto property synthesis will not synthesize property 'coordinate' declared in protocol 'MKAnnotation'

一般出现unrecognized selector sent to instance这个方法的时候大部分是因为对象被提前释放,指针变成野指针或者没有初始化就调用.这类bug很难定位所以就需要我们定制DEBUG断点

1.在Debug菜单中选择 Breakpoints -> Create Symbolic Breakpoint…

2在Symbol中填写如下方法签名:-[NSObject(NSObject) doesNotRecognizeSelector:]

3.重新运行就可以定位了.

不过也不是百试百灵的.......

我这个错误就不行,那么问题一定是出现在警告的上了--------Auto property synthesis will not synthesize property 'coordinate' declared in protocol 'MKAnnotation'-------

我这个是mapView的模型(必须遵守<MKAnnotation>协议)

定义了一个属性  @property (nonatomic) CLLocationCoordinate2D cooreinate;

就出现了上述警告,Auto property synthesis will not synthesize property这个警告一般都是和系统的命名冲突了,所以就改成@property (nonatomic) CLLocationCoordinate2D coordinate;问题就解决了!

不得不说,就差了一个字母,不懂得人改bug就得一小天啊 ,太坑了

挥毫泼墨,书写人生篇章
原文地址:https://www.cnblogs.com/Jusive/p/5150040.html