views:

573

answers:

2

Hi all,

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

+1  A: 

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

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
You should edit the original question for things like this; adding answers that aren't answers gets confusing :-).
Paul Lynch
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
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