I have an NSString declared as @property (nonatomic,copy) NSString *text in a class. When I want to get this data from the text variable I call from my other class NSString *text = self.objectInstance.text. After doing an analyze Xcode says on the line that I’m declaring the text variable
1. Property returns an Objective-C object with a +1 retain count
And then after that line
2. Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
What I don’t understand is that I neither write alloc, new, or copy thus I shouldn’t need to release this object?
Figured out what was wrong.
I used the property name
newFoowhich made the compiler think I returned a new object.So note to self: understand cocoa naming conventions.