karthikeyan
karthikeyan

Reputation: 111

mkmapview crashing in IOS 4.2

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 exception: (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:

Upvotes: 2

Views: 1148

Answers (5)

Max Mikheyenko
Max Mikheyenko

Reputation: 235

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.

Upvotes: 3

Vijay Choudhary
Vijay Choudhary

Reputation: 84

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

}

Upvotes: 0

Min Tsai
Min Tsai

Reputation: 2139

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:.

Upvotes: 0

visakh7
visakh7

Reputation: 26400

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.

Upvotes: 0

PgmFreek
PgmFreek

Reputation: 6402

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

Upvotes: 0

Related Questions