Memory leak issue in navigation controller

2019-09-04 17:28发布

I am doing memory leak testing. The tool indicates a leak in line 2 of the code below. What is the reason?

DailySales *ds = [[DailySales alloc] initWithNibName:@"DailySales" bundle:nil];
[self.navigationController pushViewController:ds animated:YES];
[ds release];

2条回答
劳资没心,怎么记你
2楼-- · 2019-09-04 18:09

Objects loaded from the NIB are leaking. Check your outlets and see if they are carefully released in dealloc.

查看更多
我想做一个坏孩纸
3楼-- · 2019-09-04 18:11

The code looks fine. Are you running in the simulator or on the device? Running Instruments on the simulator can produce false leak reports.

查看更多
登录 后发表回答