I would like to know how to run a clock or timer that works even the app is closed.
I have this code in my ViewDidLoad
:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"hh:mm:ss"];
NSString *time = [formatter stringFromDate:[NSDate date]];
This code only works when the user open up the view. But I want to know how to create a clock that works all the time even when the phone is locked. I just need some guide. Any help would be very much appreciated. Thanks.