0 xcode location google-geocoder dart flutter
我无法在 XCode 中显示/获取“XCode 项目(项目 > 签名和功能 >“+ 功能”按钮)并选择“位置更新”功能。
它在链接中
https://pub.dev/packages/geolocator
在 iOS 上,您需要将以下条目添加到您的 Info.plist 文件(位于 ios/Runner 下)才能访问设备的位置。只需打开 Info.plist 文件并添加以下内容(确保更新说明,使其在您的应用程序上下文中有意义):
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
Run Code Online (Sandbox Code Playgroud)
如果您希望在应用程序处于后台时接收更新,您还需要将后台模式功能添加到您的 XCode 项目(项目 > 签名和功能 >“+ 功能”按钮)并选择位置更新。请小心这一点,在将您的应用程序提交到AppStore时,您需要向Apple详细解释为什么您的应用程序需要这个。如果 Apple 对解释不满意,您的应用程序将被拒绝。
使用 requestTemporaryFullAccuracy({ PurposeKey: "YourPurposeKey"}) 方法时,应将字典添加到 Info.plist 文件中。
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>YourPurposeKey</key>
<string>The example App requires temporary access to the device's precise location.</string>
</dict>
Run Code Online (Sandbox Code Playgroud)
第二个键(在此示例中称为 YourPurposeKey)应与 requestTemporaryFullAccuracy() 方法中传递的 PurposeKey 匹配。可以为应用程序中的不同功能定义多个键。更多信息可以在 Apple 的文档中找到。
注意:第一次请求临时完全准确访问时,可能需要几秒钟的时间才会显示弹出窗口。这是因为 iOS 正在确定确切的用户位置,这可能需要几秒钟的时间。不幸的是,这超出了我们的控制范围。
| 归档时间: |
|
| 查看次数: |
2028 次 |
| 最近记录: |