0
ジオフェンシングを私のアプリケーションの1つとして使用しています。しかし、私はそれに一つの問題があります。私のアプリケーションが呼び出されていない- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)領域アプリケーションがの場合背景モードです。アプリがバックグラウンドのときにCLLocationManager didDetermineStateメソッドが呼び出されない
私はを確認します。背景アプリの更新はフラグはです。設定はです。以下は
私のコードです:
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
if (state == CLRegionStateInside)
{
NSLog(@"is in target region");
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"You are IN of REGION";
notification.fireDate = [NSDate date];
NSTimeZone* timezone = [NSTimeZone defaultTimeZone];
notification.timeZone = timezone;
notification.alertAction = @"Show";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
else
{
NSLog(@"is out of target region");
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"You are OUT of REGION";
notification.fireDate = [NSDate date];
NSTimeZone* timezone = [NSTimeZone defaultTimeZone];
notification.timeZone = timezone;
notification.alertAction = @"Show";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
}
CLLocationManagerが正しく設定されています。私はそれについて調べますが、私の手のために適切な解決策を得ていませんでした。誰もそれで私を助けることができますか?
ありがとうございました