According to Cocoa’s standard naming conventions, a method starting with create must return a non-country link. You are returning a saved object, but you are expecting to return an unsaved object. Thus, when the parser looks at -createImageWithContext: it sees that it should return an -createImageWithContext: object, but actually return the stored object. Hence the first warning.
In -fooWithContext: he looks at your code and says: "Hey, according to my naming conventions, createImageWithContext: should return a non-owner link, but then they release what they don’t have !!" Hence the second warning.
You can fix this by changing the name -createImageWithContext: to something that starts with new , for example, -newImageWithContext: Or you could annotate the method using the cf_returns_retained macro to tell the static analyzer that the method returns a reference to the owner.
source share