iPhone: catturare gli eventi quando l'app in esecuzione in background
-
30-10-2019 - |
Domanda
Qualcuno può farmi sapere se è possibile gestire eventi come l'orientamento, scuotere, modificare la posizione ecc. Quando la mia app in esecuzione in background?
Ho provato a seguire il codice ma viene invocato solo quando la mia app in primo piano!
- (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);
}
Grazie.
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow