0

i've my method that implement a reverseGeocoder

- (void)reversing { 
 geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:locManager.location.coordinate];
 geoCoder.delegate=self;
 [geoCoder start]; 
}

i recall reversing in another method with this:

[self performSelector:@selector(reversing) withObject:nil afterDelay:10];

and i receive

2010-04-30 17:44:17.616 high[1167:207] Retrive City Milano
2010-04-30 17:44:17.628 high[1167:207] geocoder released
2010-04-30 17:44:18.723 high[1167:207] Error Domain=MKErrorDomain Code=4 "Operation     
could not be completed. (MKErrorDomain error 4.)"
Program received signal:  “EXC_BAD_ACCESS”.

Can someone help me? :D

Keavon
  • 6,837
  • 9
  • 51
  • 79
zebra
  • 435
  • 2
  • 8
  • 20

3 Answers3

1

My answer to a similar question:

I've met and solved this issue recently. In my case, when Apple Map cannot find any result for a query, it sometimes will just throw this this "MKErrorDomain = 4" error. So I ended up just treat this as "result not found".

It was painstaking to find this out, MapKit needs a better Error handling system.

Community
  • 1
  • 1
Ascendant
  • 2,430
  • 3
  • 26
  • 34
1

It looks like you are releasing either the geocoder or its delegate, which causes the BAD_ACCESS. Odds are good that you have already released it in your error handler, or possibly via dealloc when your calling object is released.

Paul Lynch
  • 19,769
  • 4
  • 37
  • 41
  • mhmmm i make a geocoder release: on error (after that i get the error) and on didFindPlacemark, after i use my obj :-( if i set autorelease my apps crash on the first reversegeocoder call, with only a BAD_ACCESS – zebra Apr 30 '10 at 16:36
0

mhmmm now performSelector has work for mhmm 10-12 times, and after exit with this

Fri Apr 30 18:39:15 unknown high[1533] <Warning>: Retrive City Milano
Fri Apr 30 18:39:15 unknown high[1533] <Warning>: geocoder released
Fri Apr 30 18:39:21 unknown high[1533] <Error>: *** -[MKReverseGeocoder     _mapkit_cache_heapTime]: unrecognized selector sent to instance 0x181ab0
Fri Apr 30 18:39:21 unknown high[1533] <Error>: *** Terminating app due to uncaught     exception 'NSInvalidArgumentException', reason: '*** -[MKReverseGeocoder     _mapkit_cache_heapTime]: unrecognized selector sent to instance 0x181ab0'
Fri Apr 30 18:39:21 unknown high[1533] <Error>: Stack: (
853417245,
845594132,
853421053,
852917017,
852879424,
852520544,
853224229,
852521740,
852695624,
852661532,
834346012,
834339464,
871973071,
871972849,
837931029,
837876319,
837876577,
837875951,
837875865,
837875737,
837875641,
853164967,
853163039,
834376564,
817839152,
817832496,
10921,
10816
)
Fri Apr 30 18:39:21 unknown UIKitApplication:com.zeronet.TestTest[0xc5d1][1533] <Notice>: terminate called after throwing an instance of 'NSException'
Fri Apr 30 18:39:23 unknown ReportCrash[1536] <Notice>: Formulating crash report for process high[1533]
Fri Apr 30 18:39:23 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.zeronet.TestTest[0xc5d1]) Job appears to have crashed: Abort trap
Fri Apr 30 18:39:23 unknown SpringBoard[29] <Warning>: Application 'high' exited abnormally with signal 6: Abort trap
Fri Apr 30 18:39:24 unknown ReportCrash[1536] <Error>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/high_2010-04-30-183921_zeroPhone.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
zebra
  • 435
  • 2
  • 8
  • 20
  • 1
    You should edit the original question for things like this; adding answers that aren't answers gets confusing :-). – Paul Lynch Apr 30 '10 at 18:23
  • Further: it's not clear where the "geocoder released" message is coming from, which may be confusing. This message could (just) possibly also be a symptom of over-releasing following a release in your error handler, or something else. Can't tell without the code. – Paul Lynch Apr 30 '10 at 18:25
  • i've change performSelector with an nstimer, because i've not understand that performSelector start my method after x second and not every X second. btw in my old code i stop my geocoder query there: - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{ citta.text =@ "Unknow"; //NSLog(@"%@",error); [geoCoder cancel]; NSLog(@"geocoder released Unknow"); } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { citta.text = [placemark locality]; NSLog(@"Retrive City %@", [myPlacemark locality]); [geoCoder cancel]; – zebra May 01 '10 at 11:08