han*_*Dev 4 iphone memory-management objective-c analyzer ios
Analyzer报告以下代码可能存在内存泄漏.任何人都可以对此有所了解吗?我正在发布已经分配的注释.
-(AddressAnnotation *)addAdress:(NSString*)placeTitle SubTitle:(NSString*)placeSubTitle Coordinate:(CLLocationCoordinate2D)coord withId:(NSInteger) placeId{
AddressAnnotation *annotation = [[AddressAnnotation alloc] initWithCoordinate:coord];
annotation.placeTitle = placeTitle;
annotation.placeSubTitle = placeSubTitle;
annotation.museumId = placeId;
[mapView addAnnotation:annotation];
return annotation;
[annotation release];
}
Run Code Online (Sandbox Code Playgroud)
更改
return annotation;
[annotation release];
Run Code Online (Sandbox Code Playgroud)
至
return [annotation autorelease];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
86 次 |
| 最近记录: |