How to repeate NSTimer every day at particular time in iOS app

282 views Asked by At

I have method which call the sqlite method to get data and then display count to application badge number in ip. I want that the method should be called every day at 12.5 am so that it has new count for the day. I am doing in following way:

 [NSTimer scheduledTimerWithTimeInterval:300 target:self selector:@selector(makeNotificationRequest:) userInfo:nil repeats:YES];

I am calling this NSTimer in when application goes in background state.

-(void)makeNotificationRequest:(NSTimer *)timer {
    [self repeatedMethod];
}

- (void)repeatedMethod {
    SOWObject *object =[[SOWObject alloc]init];
    [object getBadgeNumber:[self getDBPath]];
    [UIApplication sharedApplication].applicationIconBadgeNumber=badgeArray.count;
}
0

There are 0 answers