I am creating a function which is going to be called after every 5 mins , untill the project is deleted from the background.
I have implemented the NSTimer , but it creates issue Like crash and being some what difficult to manage,
Is there any way to call a function repeatedly without using timer after every 5 mins ?
One approach I found is to use Alarm services but I don’t know the way to implement.
Edit: Sample one
if([[NSUserDefaults standardUserDefaults] boolForKey:@”IsUpdateConfigON”] == TRUE){
//NSLog(@"***************** One Timer to call UpdateConfig");
NSString *updatedDate = [[NSUserDefaults standardUserDefaults] valueForKey:@"IsUpdateConfigLastUpdateTime"];
int time = [Global getTimeDiff:updatedDate];
//NSLog(@"********************************** Timer value UPDATE CONGIF %d",time);
if(time >= 10){
//NSLog(@"****************** When time : %d >= %d :Config_Interval seconds ",time,Config_Interval);
cls_ConfigurationJSON *objConfig = [[cls_ConfigurationJSON alloc]init];
[objConfig loadView];
[objConfig release];
}
}
Where time is the count down of time , 1 , 2, 3 etc. This function is called after every 5 minites.
So if any one has any suggestion or code please help me.
NSTimeris the preferred way to call methods frequently. The crash that occurs might be due to issues related to release of objects or invalidation of timer etc.