iPhone: attraper les événements lorsque l'application fonctionne en arrière-plan
-
30-10-2019 - |
Question
Quelqu'un peut-il me faire savoir s'il est possible de gérer des événements comme l'orientation changée, secouer, localiser, etc. lorsque mon application fonctionne en arrière-plan?
J'ai essayé de suivre le code mais il n'est invoqué que lorsque mon application fonctionne au premier plan!
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
//if the time interval returned from core location is more than two minutes we ignore it because it might be from an old session
if ( abs([newLocation.timestamp timeIntervalSinceDate: [NSDate date]]) < 120) {
self.currentLocation = newLocation;
}
NSLog(@"lat: %f long:%f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude);
}
Merci.
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow