使用performSelector

时间:2010-04-30 15:51:15

标签: iphone selector mkreversegeocoder

我的方法是实现reverseGeocoder

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

我记得用另一种方法逆转:

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

我收到了

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

有人能帮助我吗? :d

3 个答案:

答案 0 :(得分:1)

看起来您正在释放地理编码器或其委托,这会导致BAD_ACCESS。你已经在你的错误处理程序中释放它,或者当你的调用对象被释放时,可能通过dealloc很好。

答案 1 :(得分:1)

My answer to a similar question:

我最近遇到并解决了这个问题。在我的情况下,当Apple Map找不到查询的任何结果时,它有时会抛出这个“MKErrorDomain = 4”错误。所以我最终只是将其视为“未找到结果”。

找到这个是很费劲的,MapKit需要一个更好的错误处理系统。

答案 2 :(得分:0)

mhmmm现在performSelector已经工作了10到12次mhmm,然后用这个退出

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