Potential Leak, assigning NSString-Property to UIL

2019-07-15 20:05发布

问题:

When I analyze my code it shows up a potential leak when I assign a Core Data String-attribute to a UILabel

cell.textLabel.text = prop.new_value;

Running the App with Instrument and Leaks doesn't show any problem.

回答1:

The static analyzer understands certain cocoa conventions such as methods beginning with "new" returning a retained object pointer.

I would suggesting changing "new_value" in prop.new_value to something different.

Source: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects.operands.retained_returns