1

OrientationChanged, Shake, LocationChanged 등의 이벤트를 처리 할 수 ​​있는지 알려 줄 수있는 사람이 있습니까? 내 앱이 백그라운드에서 실행될 때 알려주세요.iPhone : 백그라운드에서 실행중인 앱을 실행할 때 이벤트 잡기

다음 코드를 시도했지만 포 그라운드에서 실행중인 내 응용 프로그램에서만 호출됩니다!

- (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); 
} 

감사합니다.

답변

2

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

그런 다음 응용 프로그램은 백그라운드에서 위치 업데이트를받을 키 UIRequiredDeviceCapabilities

아래의 Info.plist 파일에 위치 서비스를 포함해야한다. 그러나 이것은 당신이

방향은 업데이트가 백그라운드에서 할 수 없습니다 변경 만 중요한 위치를 등록해야 가능 much..If을 알고 빠른 rate..without 사용자에서 배터리를 빼낸. 흔들릴 수 있습니다. 확실하지 않습니다

관련 문제