0

注釈に使用している複数の座標の配列があります。私は機能を作ろうとしているので、誰かが運転していて、その人がいずれかの地点から 1,000m 以内にいると、電話にアラートがポップアップ表示されます (アプリがバックグラウンドで実行されている場合は、ローカル通知のようなものです)。近く %@"

最善の方法を探して、

前もって感謝します

4

1 に答える 1

0

Location Awareness Programming GuideMonitoring Shape Based Regionを参照してください。

- (BOOL)registerRegionWithCircularOverlay:(MKCircle*)overlay andIdentifier:(NSString*)identifier
{
   // Do not create regions if support is unavailable or disabled
   if ( ![CLLocationManager regionMonitoringAvailable])
      return NO;

   // Check the authorization status
   if (([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) &&
      ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusNotDetermined))
      return NO;

   // Clear out any old regions to prevent buildup.
   if ([self.locManager.monitoredRegions count] > 0) {
      for (id obj in self.locManager.monitoredRegions)
         [self.locManager stopMonitoringForRegion:obj];
   }

   // If the overlay's radius is too large, registration fails automatically,
   // so clamp the radius to the max value.
   CLLocationDegrees radius = overlay.radius;
   if (radius > self.locManager.maximumRegionMonitoringDistance) {
      radius = self.locManager.maximumRegionMonitoringDistance;
   }

   // Create the region to be monitored.
   CLRegion* region = [[CLRegion alloc] initCircularRegionWithCenter:overlay.coordinate
                         radius:radius identifier:identifier];
   [self.locManager startMonitoringForRegion:region];
   return YES;
}
于 2013-06-12T02:51:00.073 に答える