title: Geofence iOS8 : Require Background Mode for iOS Geofencing
body: <p>I have used geofencing in my app. </p>
  
  <p>Geofence feature discription:</p>
  
  <p>App has two type of functionality while entering or exiting from the region:</p>
  
  <ol>
  <li><p>Reset fence:
  If user will enter in the region and that region has the functionality of reset fence then app will call one web-service and get the new fence list. This functionality is also should work in background mode.</p></li>
  <li><p>App Open:
  If user will enter in the region and that region has the functionality of app_open then app will</p>
  
  <pre><code> *a. Show alert, if the app is in foreground mode*
   *b. Show notification, if the app is in background mode*
  </code></pre></li>
  </ol>
  
  <p><strong>I have used region monitoring</strong> for achieving this functionality and also do not want to use significant location change because the app set up fences about 100 to 200 meter radius.</p>
  
  <p>Now my problem is that,</p>
  
  <ol>
  <li>Should i use background mode "App registers for location updates" for monitoring region crossing</li>
  <li><p>I have used below code for calling web-service of 'reset fence' in background mode.</p>
  
  <p>-(void) beginBackgroundUpdateTask
   {
       self.backgroundUpdateTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
       [self endBackgroundUpdateTask];
       }];
   }</p>
  
  <p>-(void) endBackgroundUpdateTask
   {
      [[UIApplication sharedApplication] endBackgroundTask: self.backgroundUpdateTask];
  self.backgroundUpdateTask = UIBackgroundTaskInvalid;
   }</p></li>
  </ol>
  
  <p>So, Should i apply any setting in info.plist due to [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandle.</p>
  
  <p>Please guide me further. I have searched lots over internet but still not found any specific answer of my above two questions.</p>
  
  <p>Note: The app is already rejected by apple due to background mode 'Location updates'. Please suggest me the way so apple will not reject the app.</p>
  
  <h2>Below is the reason.</h2>
  
  <p>2.16: Multitasking Apps may only use background services for their  intended purposes: VoIP, audio playback, location, task completion,  local notifications, etc. ----- 2.16 -----
  We found that your app uses a background mode but does not include  functionality that requires that mode to run persistently. This behavior  is not in compliance with the App Store Review Guidelines.
  We noticed your app declares support for location in the  UIBackgroundModes key in your Info.plist but does not include features  that require persistent location.
  It would be appropriate to add features that require persistent use  of real-time location updates while the app is in the background or  remove the "location" setting from the UIBackgroundModes key. If your  application does not require persistent, real-time location updates, we  recommend using the significant-change location service or the region  monitoring location service.</p>
  
  <p>Lots of thanks in advance.</p>