I have tried various things, including:
[timepicker setDate: [NSDate mondayalarmtime]];
and
timepicker.date = mondayalarmtime;
Each time, this line crashes the simulator. My mondayalarmtime is defined in viewDidLoad here:
NSDateFormatter *inputFormat = [[NSDateFormatter alloc] init];
[inputFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *inputDate = [inputFormat dateFromString: @"2011-01-01 09:00:00"];
NSLog (@"The input date %@", inputDate);
NSDate *mondayalarmtime = inputDate;
The NSLog returns:
The input date 2011-01-01 09:00:00 +0000
Putting an NSLog asking for mondayalarmtime just before it tries to set thet imepicker to mondayalarmtime returns the same..
Mondays alarm time.. 2011-01-01 09:00:35 +0000
And then when it tries to set the timepicker date to mondayalarmtime, it crashes with the report:
Program received signal: “EXC_BAD_ACCESS”.
You are sending the mondayalarmtime message to NSDate. NSDate does not understand this message
Try setting a property with mondayalarmtime and calling the getter
[timepicker setDate:[self mondayalarmtime]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With