高德地图 flutter 报LocationManager:doRequireLocationAuth错误
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了高德地图 flutter 报LocationManager:doRequireLocationAuth错误相关的知识,希望对你有一定的参考价值。
参考技术A 在flutter中使用高德地图,突然报如标题的错误,一开始我以为是plist文件没有加位置授权,一检查发现权限都有,想着以前这定位都正常的,应该是改了其他地方引起定位不了的,一一对比,是我permission_handler这个插件升级了,升级后ios这边要在podfile文件下加一下权限配置target.build_configurations.eachdo |config|
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
'PERMISSION_CRITICAL_ALERTS=1',
]
end
Flutter 使用高德地图定位
获取debug SHA1
// 使用debug.keystore获取debug SHA1
C:Usersajanuw.android>keytool -list -v -keystore .debug.keystore
输入密钥库口令: 【直接回车,没有口令】
获取发布的 SHA1
// 首先生成 key.jks https://flutter.dev/docs/deployment/android
> keytool -genkey -v -keystore ./key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
输入密钥库口令: 123asd
// 使用key.jks获取发布版的 SHA1
> keytool -list -v -keystore .key.jks
输入密钥库口令: 123asd
其他设置可以参考文档
以上是关于高德地图 flutter 报LocationManager:doRequireLocationAuth错误的主要内容,如果未能解决你的问题,请参考以下文章