6

I have used geofencing in my app.

Geofence feature discription:

App has two type of functionality while entering or exiting from the region:

  1. 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.

  2. App Open: If user will enter in the region and that region has the functionality of app_open then app will

     *a. Show alert, if the app is in foreground mode*
     *b. Show notification, if the app is in background mode*
    

I have used region monitoring 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.

Now my problem is that,

  1. Should i use background mode "App registers for location updates" for monitoring region crossing
  2. I have used below code for calling web-service of 'reset fence' in background mode.

    -(void) beginBackgroundUpdateTask { self.backgroundUpdateTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [self endBackgroundUpdateTask]; }]; }

    -(void) endBackgroundUpdateTask { [[UIApplication sharedApplication] endBackgroundTask: self.backgroundUpdateTask]; self.backgroundUpdateTask = UIBackgroundTaskInvalid; }

So, Should i apply any setting in info.plist due to [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandle.

Please guide me further. I have searched lots over internet but still not found any specific answer of my above two questions.

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.

Below is the reason.

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.

Lots of thanks in advance.

Nikh1414
  • 1,238
  • 2
  • 19
  • 35
  • You should be able to use region monitoring with location update background mode. The tricky bit is you can only monitor a few regions at a time. I would use significant location change monitoring to ask your webservice for the nearest regions to monitor. You have a few seconds for execution when you get a location update so that should be sufficient time to query your web service. – Paulw11 Sep 30 '14 at 10:18
  • Also, what specific reason did Apple give for rejecting your app. Your description sounds like a valid use of background location – Paulw11 Sep 30 '14 at 10:20
  • I have edited the my question with reason. – Nikh1414 Sep 30 '14 at 10:54
  • So they are saying you don't need to declare background location mode to use geofence region monitoring – Paulw11 Sep 30 '14 at 10:58
  • OK, So what you suggest. If i remove background location mode then the app will work as it should be ? – Nikh1414 Sep 30 '14 at 11:00

1 Answers1

9

Our app was rejected for the same reason. If all you are doing is region monitoring, you don't need the location updates background mode. We turned it off and our region monitoring works as desired. Even if the app is not running, it is launched by iOS when the user enters the region. We resubmitted the app and it was approved.

Mike Taverne
  • 9,156
  • 2
  • 42
  • 58
  • Thanks Mike, We also have submitted app using same approach as yours in Sep-2014 and the app also has approved. But i forgot to mention the solution in the thread that you did. Thanks once again. – Nikh1414 Jan 29 '15 at 10:56