timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(myMethod) userInfo:nil repeats:YES];
-(void)myMethod {
//my every second requirment
//my every minute requirment
}
My timer tics every second and its my requirement but I have another requirement that for example when my app starts its 10:05:30 am I want to trigger some code when its 10:06:00 and again when its 10:07:00 and this goes on.
I was thinking to do like this
date1 = dateFormatter ... date // this will give 10:05:30
date2 = dateFormatter ... date // this will give 10:05:00
date2 = addition of minute // this will give 10:06:00
and finally date1 compare date2 == descending // means it currently 10:06:00
But its not looking like a good solution to me, Is there any better solution?