我运行了分析器,发现了一些我无法与代码中的行关联的警告。我不确定如何处理它们。单击它们会将我带到编辑器中的正确文件,但分析器摘要结果告诉我很多。我不知道这些中的每一个都指的是什么,并且逐行浏览代码并不高效(我不知道我在寻找什么)。
Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected
Incorrect decrement of the reference count of an object that is not owned at this point by the caller
Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected
Object sent -autorelease too many times
对于最后一个警告,我删除了自动释放,它消失了,但我不知道如何释放它,因为它在返回语句中使用。
- (Client*) createNewClient {
...
Client *client = [NSEntityDescription insertNewObjectForEntityForName:@"Client"inManagedObjectContext:dataInterface.managedObjectContext];
...
return client;
}
一般来说,我该怎么处理这些?