Ionic iOS地理定位



我构建了一个使用地理定位的应用程序,但我不知道如何解决关于";使用用户位置进行跟踪";。

我试着在config.xml中添加这个,但什么也没发生。。。

我该如何解决这个问题?

在这里,我还添加了我的pod文件。我认为每次运行ionic应用程序时,它都会构建新的,或者?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ShareApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>

问题出在Info.plist中,您没有请求访问用户位置的权限。错误(和解决方案(发布在您包含的控制台错误消息中。

您需要将以下内容添加到您的Info.plist(根据您的个人需求进行修改/删除(:

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Add your description for requiring permission here</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Add your description for requiring permission here</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Add your description for requiring permission here</string>

这将告诉iOS你想访问这些功能,并向用户提供接受或拒绝的选项。

最新更新