1
在更多iPhone 3開發本書中,作者與獲取更新的的LocationManager委託方法完成後,他把這個設在該方法的末尾:CLLocationManager,MKReverseGeocoder,清理內存
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
// some code here
manager.delegate = nil;
[manager stopUpdatingLocation];
[manager autorelease];
}
同樣,在MKReverseGeocoder委託方法,當他做了他這樣做:
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark {
//some code here
geocoder.delegate = nil;
[geocoder autorelease];
}
爲什麼你需要做的,爲了清理MEMOR ÿ?我認爲規則是如果你分配/初始化它,你需要釋放它。爲什麼他將locationManager和geocoder添加到autorelease池?謝謝。