My app has a custom object that contains an NSDate.
I want to change this NSDate in my app, but this is not possible?
Code:
So this is a method from my object, that is supposed to alter the date, depending on another variable (sentcount):
(void)increaseSentAttempts
{
sentCount++;
NSDate *cal = [NSDate date];
if (sentCount < 3) {
//add 1 minute
cal = [cal dateByAddingTimeInterval:60];
}
else if(sentCount < 10)
{
//add 5 minutes
cal = [cal dateByAddingTimeInterval:300];
}
else if(sentCount < 23)
{
//add 1 hour
cal = [cal dateByAddingTimeInterval:3600];
}
else {
//add 15 hours
cal = [cal dateByAddingTimeInterval:54000];
}
//sæt nextsent attribut
nextSendAttempt = cal;
}
nextSendAttempt is my NSDate in the custom object. But seeing as the app crashes, the nextsendattempt = cal; isnt possible.
Have you set a property on the NSDate-Member of your custom object?
To change that value: