Sometime it is required to get current location's latitude and longitude when iOS app in background .
To do that you can use following way
- First you should to change in info.plist file
Add array element for App registers for location updates
- Now Second Thing
(void)applicationDidEnterBackground:(UIApplication *)application{
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(callMethod) userInfo:nil repeats:YES];
}
}
-(void)callMethod{
NSLog(@"This Line prints after every 1 sec when app in background infinite times untill app will be in foreground");
}
