2010-04-30 29 views
0

我已經在我的方法實現reverseGeocoder使用performSelector

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

回答

1

看起來您正在釋放導致BAD_ACCESS的地理編碼器或其委託。賠率很好,你已經在你的錯誤處理程序中釋放它,或者當你的調用對象被釋放時可能通過dealloc。

+0

mhmmm我做一個地理編碼器發佈:在錯誤(在那之後,我得到錯誤)和didFindPlacemark,在我使用我的obj之後:-(如果我設置autorelease我的應用程序崩潰在第一個反向地理編碼器調用,只有一個BAD_ACCESS – zebra 2010-04-30 16:36:44

0

mhmmm現在performSelector已經工作了MHMM 10-12倍,並退出後,這個

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 
+1

你應該像這樣編輯原始問題;添加不是答案的答案會讓人困惑:-)。 – 2010-04-30 18:23:45

+0

進一步:目前還不清楚「地理編碼器發佈」消息來自哪裏,這可能令人困惑。這個消息可能(僅)也可能是在你的錯誤處理程序中釋放之後過度釋放的一種症狀,或者其他的東西。沒有代碼就說不清楚。 – 2010-04-30 18:25:55

+0

我用nstimer更改了performSelector,因爲我不明白performSelector在x秒之後啓動我的方法,而不是每隔X秒。 順便說一句我的舊代碼,我停止我的地理編碼查詢有: - (空)reverseGeocoder:(MKReverseGeocoder *)地址解析器didFailWithError:(NSError *)錯誤{ \t citta.text = @ 「不明」; \t // NSLog(@「%@」,error); \t [geoCoder取消]; \t NSLog(@「geocoder released Unknow」); (void)反向地理編碼器:(MKReverseGeocoder *)地理編碼器didFindPlacemark:(MKPlacemark *)地標 { citta.text = [地標標記]; NSLog(@「Retrive City%@」,[myPlacemark locality]); [geoCoder取消]; – zebra 2010-05-01 11:08:30

1

My answer to a similar question:

我見過,最近解決了這個問題。在我的情況下,當Apple Map找不到任何查詢結果時,它有時會拋出這個「MKErrorDomain = 4」錯誤。所以我最終只是把它當作「未找到結果」。

找到這件事很費力,MapKit需要更好的錯誤處理系統。