I am having trouble figuring out the cause of this crash.
I have an iPad application with a MapView and Tableview on the same screen. I am trying to allow the user to select a row in the table to then highlight the corresponding pin in the map or vice versa. In the simulator it works fine. On the device it works for a while, but then if I keep doing it will crash with a SIGSEGV. I can't figure out why.
It seems to happen only when going from the selected tableview row to selecting the pin in the mapview.
Here is the code
Place *p = [self.results objectAtIndex:[indexPath row]];
NSArray *annon = [self.mapView annotations];
for ( int i = 0; i < [annon count]; i++)
{
NSObject *a = [annon objectAtIndex:i];
if ([a isKindOfClass:PlaceAnnotation.class])
{
PlaceAnnotation *pa = (PlaceAnnotation *)a;
if (p.placeid == pa.placeid)
{
[self.mapView selectAnnotation:pa animated:YES];
break;
}
}
}
Here is the type of crashes we are seeing as a result of executing this code.
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x9
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x317c4f78 0x317c1000 + 16248
1 CoreFoundation 0x3195576b 0x318c6000 + 587627
2 CoreFoundation 0x318cd644 0x318c6000 + 30276
3 CoreFoundation 0x318cf701 0x318c6000 + 38657
4 MapKit 0x36b061f3 0x36ab9000 + 315891
5 MapKit 0x36acf33d 0x36ab9000 + 90941
6 MapKit 0x36acf2f1 0x36ab9000 + 90865
7 MapKit 0x36ad29bd 0x36ab9000 + 104893
8 MapKit 0x36acdf03 0x36ab9000 + 85763
Any help would be appreciated.