Geofence iOS8 : Require Background Mode for iOS Geofencing [closed]

我与影子孤独终老i 提交于 2019-12-07 06:27:25

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/26118210/geofence-ios8-require-background-mode-for-ios-geofencing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!