Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem while Working in background and Nstimer?
    primarykey
    data
    text
    <p>Hi i have atask to develop the application with Nstimer and background process.</p> <p>I have already implement background process with timer. And it is excuting good.but i have problem when i minimize application first time at that time it is not running the background process. after minimizing application 3 to 4 times. After that it is working smoothly. i also display the code of background task and timer as follow.</p> <pre><code> - (void)applicationDidEnterBackground:(UIApplication *)application { UIApplication* app = [UIApplication sharedApplication]; NSLog(@"Application enter in background"); [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(updateCounter:) userInfo:nil repeats:YES]; } </code></pre> <p>And My updateCounter method is as given follow:</p> <pre><code> - (void)updateCounter:(NSTimer*)timer { NSString *id = [[UIDevice currentDevice] uniqueIdentifier]; NSLog(@"uniqueid:%@",id); locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation]; CLLocation *location = [locationManager location]; // Configure the new event with information from the location CLLocationCoordinate2D coordinate = [location coordinate]; NSString *latitude = [NSString stringWithFormat:@"%f", coordinate.latitude]; NSString *longitude = [NSString stringWithFormat:@"%f", coordinate.longitude]; NSLog(@"dLatitude : %@", latitude); NSLog(@"dLongitude : %@",longitude); } </code></pre> <p>Is their any problem related code Please help me to solve it. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload