gpt4 book ai didi

ios - 如何防止iOS应用程序被挂起

转载 作者:行者123 更新时间:2023-11-28 07:33:30 25 4
gpt4 key购买 nike

我有一个 iOS 应用程序需要跟踪用户的地理位置以进行研究项目。但是,该应用程序会在几个小时后被 iOS 自动暂停,并且地理定位跟踪停止工作。

地理围栏不够准确,因为它不够准确。

有什么方法可以防止应用程序被挂起(除非用户手动终止它)?

我想到的一种方法是无限期地播放无声音乐,并通过MPRemoteCommandCenter在锁屏上显示音乐控件。 ,就像 Spotify 的运作方式一样。

这会让应用程序保持活力吗? (因为我相信 Spotify 永远不会被杀死,除非用户手动终止它?)

最佳答案

我有一个类似的应用程序,它使用用户位置进行跟踪。检查您是否在 info.plist 中拥有所有这些权限。并明确告诉用户您为什么使用位置权限

<key>NSLocationAlwaysUsageDescription</key>
<string>Application needs permission to access your current location.
</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Application needs permission to access your current location.
</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>

关于ios - 如何防止iOS应用程序被挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53934175/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com