地理栅栏iOS8:需要iOS地理围栏的背景模式 [英] Geofence iOS8 : Require Background Mode for iOS Geofencing

查看:299
本文介绍了地理栅栏iOS8:需要iOS地理围栏的背景模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中使用了地理围栏。

I have used geofencing in my app.

地理围栏功能说明:

应用程序在进入或退出该区域时有两种类型的功能:

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


  1. 重置围栏:
    如果用户将进入该区域并且该区域具有重置围栏的功能,那么应用程序将调用一个Web服务并获取新的围栏列表。此功能也应该在后台模式下工作。

  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.

App Open:
如果用户将进入该区域并且该区域具有app_open的功能然后app将

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*


我使用区域监控来实现此功能,并且也不想使用重要的位置更改,因为应用程序设置了大约100到200米半径的围栏。

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.

现在我的问题是,


  1. 我应该使用后台模式应用程序寄存器进行位置更新来监控区域交叉

  2. 我在后台模式下使用以下代码调用'重置栏'的网络服务。

  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) beginBackgroundUpdateTask { self.backgroundUpdateTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [self endBackgroundUpdateTask]; }]; }

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

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

因此,我应该在info.plist中应用[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandle。

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.

注意:由于背景模式,该应用程序已被Apple拒绝了位置更新。请建议我这样苹果不会拒绝该应用程序。

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.

2.16:多任务应用程序只能将后台服务用于其预期目的:VoIP,音频播放,位置,任务完成,本地通知等.----- 2.16 -----
我们发现您的应用使用了背景模式但不包括要求该模式持久运行的功能。此行为不符合App Store审查指南。
我们注意到您的应用声明在Info.plist中的UIBackgroundModes键中声明了对位置的支持,但不包括需要持久位置的功能。
在应用程序处于后台时添加需要持续使用实时位置更新的功能或从UIBackgroundModes键中删除location设置是合适的。如果您的应用程序不需要持久的实时位置更新,我们建议您使用重要更改位置服务或区域监控位置服务。

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.

提前多多谢意。

推荐答案

我们的应用程序因同样原因被拒绝。如果您所做的只是区域监控,则不需要位置更新后台模式。我们将其关闭,我们的区域监控工作正常。即使应用程序未运行,也会在用户进入该区域时由iOS启动。我们重新提交了应用程序并获得批准。

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.

这篇关于地理栅栏iOS8:需要iOS地理围栏的背景模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆