質問

私はcllocationとmkreversegeocoderと都市名をretreivingにしてみてくださいよ。 私のviewDidLoadメソッドで私istance cllocationmanagerます:

self.locManager = [[CLLocationManager alloc] init];
locManager.delegate = self;
locManager.desiredAccuracy = kCLLocationAccuracyBest;
[locManager startUpdatingLocation];

以降ます:

- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation 
*)newLocation
fromLocation:(CLLocation *)oldLocation {
//some code to retrieve my information

MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc]     
initWithCoordinate:newLocation.coordinate ];
geoCoder.delegate = self;
[geoCoder start];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark  
*)placemark
{
MKPlacemark *myPlacemark = placemark;
citta.text = [placemark locality];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
citta.text =@ "Unknow";

アプリケーションは、私は私の値を取得初回のみ動作します。二度目アプリのクラッシュに。 私は、ジオコーダが開始されているためだと思うと私は、唯一のistanceが実行されていなければならないと思います。 (しかし、私は本当にこののSHUREありませんよ...)。どのように私はジオコーダが実行されているcontrollことができますか?

私はどのように私はnewlocation.coordinateを盗んことができます... cllocationcoordinate2dを使用しますが、私のviewDidLoadでmkreversegeocoder istanceできることがわかりましたか?

私は部分的にクラス変数としてジオコーダを宣言し、チェックを解決してきました。

if (self.geocoder != nil) {
   [geocoder release];
}

しかし....私の

であれば
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark  
*)placemark

または私の

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailedWithError:(@NSError 
*)error

私は私のオブジェクトを解放するか、キャンセル? 私は愚かな感じている:D

scroll top