ios info-plist 文件中没有所需的后台模式键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21524421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 23:20:04  来源:igfitidea点击:

Required Background modes key is not there in info-plist file

iosiphoneios5info-plist

提问by Saurabh Gulia

I want to set required background mode key value so that my app also works in background. Actually i want to get the user location updates when the app is in background, but there is no key called required background mode key in my info-plist file. How to set this key and jow to bring this in my file?

我想设置所需的后台模式键值,以便我的应用程序也可以在后台运行。实际上,我想在应用程序处于后台时获取用户位置更新,但是在我的 info-plist 文件中没有称为所需后台模式键的键。如何设置此键和 jow 以将其放入我的文件中?

回答by Mani

In Xcode 5, Project setting -> Target -> Capabilities -> Background modes -> check Location updates.

在 Xcode 5 中, 项目设置 -> 目标 -> 功能 -> 背景模式 -> 检查位置更新。

If you are using an earlier version of Xcode, set the background mode for Location as in the following screenshot.

如果您使用的是早期版本的 Xcode,请按照以下屏幕截图设置 Location 的背景模式。

plist background modes

plist background modes

回答by Toseef Khilji

In Xcode 5, Select your app, then enabled background modes and select location updates

在 Xcode 5 中,选择您的应用程序,然后启用后台模式并选择位置更新

Target > Capabilities

目标 > 能力

Xcode background mode settings screenshot

Xcode background mode settings screenshot

回答by Anil Varghese

You can add that key to the info.plist. If you are using Xcode 5 it's very simple. In Capabilities just turn on the Background Modes.

您可以将该键添加到 info.plist。如果您使用的是 Xcode 5,则非常简单。在功能中只需打开背景模式。

Xcode Capabilities screenshot

Xcode Capabilities screenshot