Master data displays analyzer warnings

I am doing the last steps on the application, and I get rid of every compiler / analyzer warning.

I have a bunch of class methods that restrict my applications from accessing Core Data objects. This "provokes" the analyzer.

+ (CDProductEntity*) newProductEntity {

    return (CDProductEntity*)[NSEntityDescription insertNewObjectForEntityForName:@"CDProductEntity" inManagedObjectContext:[self context]];
}

This leads to an analyzer warning:

An object with a return value of +0 for the caller, where +1 (owning) is expected to be counted

In the method that calls the above class method, I have the following:

CDProductEntity *newEntity = [self newProductEntity];

This leads to an analyzer warning:

The method returns an Objective-C object with saving the score +1 (owning the link)

Core Data , ? , +0, , , +1, .

, , , ?

+3
1

, - obj-c alloc, new copy , , - .

docs:

, .
  "" "alloc" "" "" (, alloc, newObject mutableCopy).

, ""

+6

Source: https://habr.com/ru/post/1783401/


All Articles