Reputation: 183
I have written a code for UIButton press to decrement date. The present date is shown in a UILabel text property and it changes to the previous date when the button is pressed. The following code works perfectly fine for iOS5 but doesn't work with iOS6. With iOS6, it gives the output as Dec 31, 1999 or null.
- (IBAction)showPrevDate:(id)sender
{
NSString *dateForDecrement = _showDateLbl.text;
[dateFormatter setDateFormat:@"MMM d, yyyy (EEE)"];
NSDate *dateObjectForDecrement = [dateFormatter dateFromString:dateForDecrement];
int subtractDays = 1;
dateAfterDecrement=[dateObjectForDecrement dateByAddingTimeInterval:-(24*60*60 * subtractDays)];
_showDateLbl.text = [NSString stringWithFormat:@"%@", [dateFormatter stringFromDate:dateAfterDecrement]];
}
Can anybody verify this, or tell me if its's a bug in iOS6 ?
Thanks guys.
Upvotes: 0
Views: 233
Reputation: 3368
I think it's a bug. I ran into same issues with different behaviours between iOS 5 and 6.
Check this out:
http://openradar.appspot.com/12385667
http://openradar.appspot.com/12358210
Maybe you're into one of these.
Upvotes: 2