开发者

mkmapview crashing in IOS 4.2

开发者 https://www.devze.com 2023-03-04 18:06 出处:网络
This is karthik. I am getting this following error when i run my application. When my application trying to find the user location its crashing. Actually in IOS 4.0 and 4.1 its working fine. Only in 4

This is karthik. I am getting this following error when i run my application. When my application trying to find the user location its crashing. Actually in IOS 4.0 and 4.1 its working fine. Only in 4.2 its crashing. Can you help me?

CoreAnimation: ignoring exc开发者_如何学Goeption: (null) must implement title when canShowCallout is YES on correspoding view > visible:0 +0.00000000, +0.00000000 2011-05-09 12:32:40.631 HOV[1821:207] * Terminating app due to uncaught exception 'NSGenericException', reason: '> visible:0 +38.91791916, -77.20580292 must implement title when canShowCallout is YES on correspoding view > visible:0 +38.91791916, -77.20580292' * Call stack at first throw:


You should do exactly what the error text tells you to: your MkAnnotation delegate should implement

- (NSString*)title

method, which provides the text to be shown in the callout view. The method is optional and is called only if you set canShowCallout to YES.


Check the title in the annotation view. I think title is set to null some times...


Check all the annotations that are plotted. I think there is a case where an annotation does not have a title which leads to this crash. Check if all the annotations have values for title.


I got the same error when running on iOS 4.2.1. The app did not crash on iOS 5.x. I also made sure that the Annotations used all implemented title method.

It turned out that the annotation passed to selectAnnotation:animated: was nil at that time.

This explains why the error message mentions (null). iOS 4.2.1 appears to check for the title method even if the annotation is not defined.

CoreAnimation: ignoring exception: (null) must implement title when canShowCallout is YES on correspoding view

So this was fixed by making sure annotation was not nil before calling selectAnnotation:animated:.


I had a similar problem. In my case the method -(MKAnnotationView *)mapView:(MKMapView *)mView viewForAnnotation:(id<MKAnnotation>)ann{ } was being called twice. So I put the following code there which worked for me:

if (myAnnotation == annotation) {

    [pinView setCanShowCallout:YES];

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号