2011-02-09 8 views
0

CLLocationにアクセスしようとするとエラーが発生します。理由を教えてください。CLLocation取得EXC_BAD_ACCESS

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { 

    if (newLocation != nil) { 
     currentLocation = newLocation; 
     NSLog(@"locationManager: %@", currentLocation); 
    } 
} 

locationManager:< 36.45307493、 28.22220462> +/- 100.00メートル(速度-1.00 MPS /もちろん

CLLocation *currentLocation; 
@property (nonatomic, retain) CLLocation *currentLocation; 

私は、ロケーションマネージャから場所のためのフィードバックをgeetingています-1.00)9/2/11 10:14:58 π.μ. GMT + 02:00

が、私はDidSelectAnnotationViewからcurrentLocationにアクセスしようとしている私はEXC_BAD_ACCESSを取得する:私はそれにアクセスすることはできませんなぜ

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { 

    NSLog(@"current Location: %@", currentLocation); 

} 

あなたは説明してくださいできますか?

多くのありがとうございます!

答えて

3

あなたは場所を保持していません。それは好きですか:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { 

    if (newLocation != nil) { 
     self.currentLocation = newLocation; /// The change is here 
     NSLog(@"locationManager: %@", currentLocation); 
    } 
} 
関連する問題