Qt Positioning on iOS
在iOS上的Qt定位
Using Qt Positioning Services from an iOS App
从iOS应用程序使用Qt定位服务
To enable an app to use positioning services on an iOS device, entries must be added to the Info.plist file based on whether the positioning services are needed when the app is in use or when the app is running in the background.
要使应用程序能够在iOS设备上使用定位服务,必须根据应用程序在使用中还是在后台运行时是否需要定位服务,将条目添加到Info.plist文件中。
Once the permission is added, the user needs to grant the permission for the positioning services to be available when the app requests the positioning service. The user can change this by going into Settings > Privacy > Location Services, scrolling down to find the app, and selecting an option. The location services must be on for the positioning services to work.
添加权限后,当应用程序请求定位服务时,用户需要授予定位服务可用的权限。用户可以通过进入“设置”>“隐私”>“位置服务”,向下滚动以找到应用程序,然后选择一个选项来更改此设置。定位服务必须打开才能工作。
Using Foreground Location Services Permission
使用前景定位服务许可
If an app makes use of the positioning services when it is running, the Info.plist file needs to have an entry with the key NSLocationWhenInUseUsageDescription
and a value with a text string giving the user the reason the app makes use of it.
如果一个应用程序在运行时使用了定位服务,则Info.plist文件需要有一个带有NSLocationWhenInUseUsageDescription
键的条目和一个带有文本字符串的值,该字符串向用户说明应用程序使用它的原因。
<key>NSLocationWhenInUseUsageDescription</key>
<string>The reason why the app needs location services</string>
Use Background Location Services Permission
使用后台定位服务权限
If the app makes use of location services even when it is running in the background, there needs to be an entry with the key NSLocationAlwaysAndWhenInUseUsageDescription
and the reason as string value as well as NSLocationWhenInUseUsageDescription
.
如果应用程序即使在后台运行时也使用了位置服务,则需要有一个包含NSLocationAlwaysAndWhennUseDescription键的条目,并将原因作为字符串值以及NSLocationWhenInUseUsageDescription
。
<key>NSLocationWhenInUseUsageDescription</key>
<string>The reason why the app needs location services</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>The reason why the app needs location services</string>
Note: The Info.plist file is automatically generated, and changes made can be overwritten by qmake or CMake unless measures are taken. See Platform Notes - iOS for more information.
注意:Info.plist文件是自动生成的,除非采取措施,否则所做的更改可能会被qmake或CMake覆盖。有关更多信息,请参阅平台说明-iOS。
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.