简体   繁体   English

由于使用背景定位模式进行地理围栏,iOS App被拒绝

[英]iOS App Rejected due to use of background location mode for geofence

Recently apple has rejected my app due to below reason. 最近,苹果由于以下原因拒绝了我的应用。

Below is the explanation of functionality: 以下是功能说明:

  1. We require to track user entry and exit in the regions received from the server 我们需要跟踪从服务器收到的区域中的用户进入和退出
  2. If users enter in some defined region, We are also calling web-service and prepare the new set of geofence. 如果用户输入某个定义的区域,我们也将调用网络服务并准备新的地理围栏。 We defined this type of fences as reset fence. 我们将这种类型的栅栏定义为重置栅栏。
  3. So it is also possible, Some time app is in background mode and user will might be enter in reset fence region so we require to call web-service and set up new fences in background. 因此,有时应用程序处于后台模式也是可能的,并且用户可能会进入重置围栏区域,因此我们需要调用Web服务并在后台设置新的围栏。

We have used below flags of info.plist so app can run in background: 我们在info.plist的下面使用了标记,因此应用可以在后台运行:

1 Required background modes: 1必需的背景模式:

  • App downloads content from the network 应用程序从网络下载内容
  • App registers for location updates 应用程序注册以更新位置

2 Required device capabilities: 2所需的设备功能:

  • armv7 armv7

Additional information: App supports iOS 5.0 to iOS 8 附加信息:应用程序支持iOS 5.0至iOS 8


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 ----- 2.16:多任务应用程序只能将后台服务用于其预期目的:VoIP,音频播放,位置,任务完成,本地通知等。----- 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. 此行为不符合《 App Store审查指南》。

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. 我们注意到您的应用在Info.plist的UIBackgroundModes项中声明了对位置的支持,但其中不包含需要永久位置的功能。

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. 当应用程序在后台运行时,添加需要持续使用实时位置更新的功能,或者从UIBackgroundModes键中删除“位置”设置,将是合适的。 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. 如果您的应用程序不需要持续的实时位置更新,则建议使用重大更改位置服务或区域监视位置服务。

For more information on these options, please see the "Starting the Significant-Change Location Service" and "Monitoring Shape-Based Regions" sections in the Location Awareness Programming Guide. 有关这些选项的更多信息,请参见《位置感知编程指南》中的“启动重要更改位置服务”和“监视基于形状的区域”部分。

If you choose to add features that use the Location Background Mode, please include the following battery use disclaimer in your Application Description: 如果您选择添加使用“位置背景模式”的功能,请在“应用程序说明”中包括以下电池使用免责声明:

"Continued use of GPS running in the background can dramatically decrease battery life." “继续使用在后台运行的GPS会大大降低电池寿命。”


Any one please suggest me that 任何人都可以建议我

  1. In my case what info.plist settings i should use ? 就我而言,我应该使用哪些info.plist设置?
  2. What other changes i should check in the code. 还有什么其他更改我应该在代码中检查。 ?

Thanks in advance. 提前致谢。

First of all you need to remove Location updates from the UIBackgroundModes . 首先,您需要从UIBackgroundModes删除位置更新。

Now, you need to write some code to handle what happens when the user enters a region. 现在,您需要编写一些代码来处理用户进入区域时发生的情况。 I wrote a very simplistic outline of a solution which detects when the user enters a region, sends that region's center to the web service (so it knows how to calculate the new regions) and monitors the new regions that are returned. 我写了一个非常简单的解决方案概要,它检测用户何时进入区域,将该区域的中心发送到Web服务(这样它就知道如何计算新区域)并监视返回的新区域。

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
    [self setNewFencesFromWebServiceAtCoordinates:[(CLCircularRegion *)region center] withCompletionBlock:^(NSArray *locations) {
        int i = 0;
        for (CLLocation * location in locations)
        {
            i++;
            CLLocationCoordinate2D regionCenter = [location coordinate];
            [manager startMonitoringForRegion:[[CLCircularRegion alloc] initWithCenter:regionCenter radius:100.0 identifier:[NSString stringWithFormat:@"location %d",i]]];
        }
    }];
}

- (void)setNewFencesFromWebServiceAtCoordinates:(CLLocationCoordinate2D)coordinates withCompletionBlock:(void(^)(NSArray * locations))completion
{
    NSArray * newRegions;

    // Write code to get the new regions from the web service and store them in an array of locations

    completion(newRegions);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM