当前应用没有位置权限,正在请求权限吗?

时间:2019-01-13 15:07:01

标签: xamarin xamarin.forms xamarin.ios

我为我的应用程序使用了Xamarin Forms 3.3。在iOS上调试应用测试时。

我的日志文件始终有2行:

2019-01-13 21:19:59.575 Marine.Mobile.iOS[2751:542039] Currently does not have Location permissions, requesting permissions

2019-01-13 21:19:59.599 Marine.Mobile.iOS[2751:542039] This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both “NSLocationAlwaysAndWhenInUseUsageDescription” and “NSLocationWhenInUseUsageDescription” keys with string values explaining to the user how the app uses this data

我在文件Info.plist中设置为Location Service

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Marine requires GPS to track cars and job orders</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Marine requires GPS to track cars and job orders</string>

但无法运行或调试程序。

它无法显示项目Image

错误:Image Error

我尝试仅使用文件Info.plist中的以下代码:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Marine requires GPS to track cars and job orders</string>

=>项目可以运行调试。

然后,我尝试不使用NSLocationWhenInUseUsageDescription并将其替换为NSLocationWhenInUseUsageDescription,但是程序无法调试。

<key>NSLocationWhenInUseUsageDescription</key> <string>Marine requires GPS to track cars and job orders</string>

=>为什么代码无法将其添加到文件Info.plist中:

请帮助我!谢谢!

1 个答案:

答案 0 :(得分:0)

尝试以下操作:双击YourProject.iOS。选择配置并添加新配置。