Note: It is not GUI based program.
int main(int argc, char *argv[])
{
NSLog(@"ENTER in main");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
locationAppDelegate *loc = [[locationAppDelegate alloc] init];
[pool drain];
NSLog(@"EXIT from main");
}
-(id) init
{
NSLog(@"ENTER in init()");
[super init];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
NSTimer *currentTimer = [NSTimer scheduledTimerWithTimeInterval:20.0
target:self
selector:@selector(Action)
userInfo:nil
repeats:YES];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop addTimer:currentTimer forMode:NSDefaultRunLoopMode];
[runLoop run];
NSLog(@"EXIT from init()");
return self;
}
-(void) Action
{
NSLog(@"ENTER in Action");
[locationManager startUpdatingLocation];
NSLog(@"EXIT from Action");
}
-(void)locationManagerCLLocationManager *)manager
didUpdateToLocationCLLocation *)newLocation
fromLocationCLLocation *)oldLocation
{
NSLog(@"ENTER in didUpdateToLocation");
NSLog(@"%f",newLocation.coordinate.latitude);
NSLog(@"%f",newLocation.coordinate.longitude);
[locationManager stopUpdatingLocation];
NSLog(@"EXIT from didUpdateToLocation");
}
The program works perfectly on Simulator.
But when I run this program on actual device, here is the output:
2012-03-26 11:50:20.622 location[369:707] ENTER in main
2012-03-26 11:50:20.632 location[369:707] ENTER in init()
2012-03-26 11:50:40.649 location[369:707] ENTER in Action
2012-03-26 11:50:40.656 location[369:707] EXIT from Action
2012-03-26 11:51:00.648 location[369:707] ENTER in Action
2012-03-26 11:51:00.654 location[369:707] EXIT from Action
and so on .....
Can anybody help me?

Help

