[英]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: 以下是功能说明:
We have used below flags of info.plist so app can run in background: 我们在info.plist的下面使用了标记,因此应用可以在后台运行:
1 Required background modes: 1必需的背景模式:
2 Required device capabilities: 2所需的设备功能:
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 任何人都可以建议我
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.