I'm learning to use the mkreversegeocoder classes and have got it working using the following three lines of code and implementing the didFindPlacemark method.
geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:[u coordinate]];
[geoCoder setDelegate:self];
[geoCoder start];
The above works fine, however... in trying to improve my app by thinking about managing memory and resources, i am trying to add an autorelease the geoCoder allocation as such:
geoCoder = [[[MKReverseGeocoder alloc] initWithCoordinate:[u coordinate]] autorelease];
The above pattern is used by apple in their documentation so it seems like the right thing to do. However, when I add the autorelease, the didFindPlacemark method never gets called. It's as if the autorelease releases the geoCoder object immediately.
The geoCoder object is declared as an ivar, so it should work. the apple example using this pattern works so the problem must be with my implementation, but i cannot work out where i am going wrong.
i would appreciate anyone input as to whats happening and how i can get this going.
best regards