iOS因后台定位被拒,有什么解决方法?

iOS因后台定位被拒,有什么解决方法?_第1张图片

相信iOS开发的小伙伴们最头疼的一件事情就是在开发操作的过程中因后台定位被拒。谨以分享大家~

​现在做的一个app要用后台定位计算运动距离。我的方法是在appdelete里保持后台,写了一个通知让CLLocation在另一个控制器运行,在定位成功后调用百度定位方法计算距离,但是可怜的被拒了.

理由如下:

Your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not have any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.

Next Steps

To resolve this issue, please revise your app to include features that require the persistent use of real-time location updates while the app is in the background.

If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.

Resources

For more information, please review theStarting the Significant-Change Location ServiceandMonitoring Geographical Regions.

Request a phone call from App Review

At your request, we can arrange for an Apple Representative to call you within the next three business days to discuss your App Review issue.

To request a call and ensure we have accurate contact information, reply directly to this message with a contact name and direct phone number to reach you.

需要在info.plist里面加 Privacy - Location Always Usage Description

 后面写明你要后台定位的原因,这时候在APP第一次启动的时候就会弹框上面多了一行字 如图

这个时候再次启动APP的时候 在获取权限的弹框里会多出几个字

iOS因后台定位被拒,有什么解决方法?_第2张图片

然后再AppStore上传时有一个应用描述,在最后加一个类似免责声明的东西:

长时间使用GPS在后台运行可能显著减少电池寿命. 这句话很重要,要不然会被拒绝 这个参考百度地图

iOS因后台定位被拒,有什么解决方法?_第3张图片

就是你在PLIST里加了后台定位,但是你的APP中的功能并没有体现。

普通的定位不需要加后台运行,你如果只需要APP运行时定位,就不需要开后台定位。

如果你的APP中真的有后台定位的功能,比如运动类APP,需要实时定位记录轨迹等,你就在APP的描述中说清楚,同时,免责声明不是在plist里写,是在itunes中写APP介绍的时候加上的。也就是用户在app store搜索你的APP的时候,看到APP介绍时候应该有那么一句,官方有正规说法,我记得不清楚,反正就是:长时间定位有可能损耗电池balabala的。你翻出那一句,粘贴到app描述中就行了。

有一句话叫做"三人行必有我师焉",那么做为一个开发者来说,有一个学习的氛围跟一个交流圈子特别重要。众汇iOS学习交流Q群562984021欢迎大家加入,~.~小伙伴们一起学习交流,共同进步吧 !

你可能感兴趣的:(iOS因后台定位被拒,有什么解决方法?)