我正在开发一个 IOS 应用程序。我确实使用 XCode 仪器进行了分析,如果我不编写自动释放,则显示“潜在的内存泄漏”消息。这是下面代码块中的错误。我不确定。
//TransferList.h
@property (nonatomic,retain) WebServiceAPI *webApi;
//TransferList.m
@implementation TransferList
@synthesize webApi;
- (void)viewDidLoad
{
[super viewDidLoad];
self.webApi = [[[WebServiceAPI alloc] init] autorelease];
}
- (void)dealloc
{
[webApi release];
[super dealloc];
}