Sabbath
Sabbath

Reputation: 91

Incorrect decrement of the reference count of an object that is not owned

I got a problem when analyzing my code below :

NSDate *formatterDate = [inputFormatter dateFromString:smBook.time_limit];
formatterDate = [formatterDate initWithTimeInterval:1*24*60*60 sinceDate:formatterDate];

The message is : Incorrect decrement of the reference count of an object that is not owned at this point by the caller .

Can anyone tell me the reason why ?

Upvotes: 0

Views: 114

Answers (2)

Pandey_Laxman
Pandey_Laxman

Reputation: 3918

It seems that the message not occurring from the above line please check the whole class in or enable zombie objects from edit schemes of your project

Upvotes: 0

Apurv
Apurv

Reputation: 17186

Change below line:

formatterDate = [formatterDate initWithTimeInterval:1*24*60*60 sinceDate:formatterDate];

with this line:

NSDate *newDate = [[NSDate alloc] initWithTimeInterval:1*24*60*60 sinceDate:formatterDate];

Release this newDate when you are doe with your operations.

Upvotes: 1

Related Questions