Thursday 15 August 2013

ios - Incorrect decrement of the reference count of an object that is not owned at this point by the caller For retain property -


I have created an NSString with the retaining of FName property, and synthesized that property I have seen that the property has been defied Started on

My actual problem is, I have used [self.fName release], this sample is working fine, but static analysts count this error 'reference count of an object owned by the caller at this point Showing in the form of 'wrong shortage'.

Reference Code: @ View Interface Viewer: UIViewController @property (nonatomic, retain) NSString * fName; @end @implementation ViewController @ synthetize fName; - (zero) viewDidoadload [[Super Viewedload]; // Setup an additional after loading the view, usually from a nibb. Self.fName = @ "Hello"; [Self.fName release]; // Analyzer Shōzin error is here} --------- ------ End

There is no need to release you / nothing init if you are doing something like this:

  self.fName = [[NSString alloc] InitWithString: @ "hello"];   

Then you have to leave yourself. FName.

OfferLevel = NumberOffAloc as a rule of thumb number.

And now, use the golden rule, ARC :)

No comments:

Post a Comment