简体   繁体   中英

Why is didFindPlacemark never hit?

I am struggling with getting my MKReverseGeocoder to actually finish. This is what I do:

// reverse geocode the user location
geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
geocoder.delegate = self;
[geocoder start];

The userLocation coordinate IS valid, I know that. I have didFindPlacemark and didFailWithError, and neither of those are hit... Either I have the delegate set up wrong or I have no idea...Here's the header:

@interface E_85AppDelegate : UIViewController <UIApplicationDelegate, MKMapViewDelegate, MKReverseGeocoderDelegate, CLLocationManagerDelegate>
{   
    IBOutlet UIWindow *window;
    IBOutlet UITabBarController* tabBarController;
    IBOutlet MKMapView*   mapView;
    IBOutlet MKReverseGeocoder* geocoder;
        // other class members...
}

Any ideas?

Evidently my understanding of autorelease is not very good. It releases the geocoder before didFindPlacemark is ever sent the message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM