以下代码中有一个泄漏的对象。我如何解决它?我尝试添加一个[apiViewController版本];但是当我分析该应用程序时,我仍然得到:



 if (idx == 2) {
        NSLog(@"you touched menu 2");

        APICallsViewController *apiViewController = [APICallsViewController alloc];
        [self.navigationController pushViewController:apiViewController animated:YES];
        //[apiViewController getFriendsCallAPIDialogFeed];
        [apiViewController getAppUsersFriendsUsing];


    }


谢谢你的帮助

最佳答案

您忘记了-init和-release。

APICallsViewController *apiViewController = [[APICallsViewController alloc] init];
...
[apiViewController release];


您可能需要阅读Objective-C programming

关于iphone - 如何修复保留计数为+1的泄漏对象?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10673713/

10-13 03:52