내 Xcode의 빌드 메뉴에서 "빌드 및 분석"버튼을 눌렀을 때 문제가 발생했습니다. 분석을 통해 나중에 반환하고자하는 변수를 릴리스 할 것을 제안합니다. 코드는 다음과 같습니다.반환 될 변수를 해제하는 방법은 무엇입니까?
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
//I do some other thing here
MKPinAnnotationView *annView=
[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"addressLocation"];
//I do some other thing here
return annView;
}
문제를 일으키지 않고 annView를 릴리스하고 반환 할 수 있습니까?
나는 그것을 생각했다. 이 경우 잘 작동하는지 확실하지 않습니다. 내가 객관적으로 매우 초보자이기 때문에 내가 틀렸다면 나에게 알려주기 바란다. –
@Winston Chen : 이것은 정확히'autorelease'가하는 것입니다. – dreamlax