flutter引入高德地图_Flutter接入高德地图后运行报错
1、flutter開發(fā)接入高德地圖包后運(yùn)行報(bào)下面錯(cuò)誤信息
fatal error: 'simple_permissions/simple_permissions-Swift.h' file not found
運(yùn)行在iPhone手機(jī)時(shí)出現(xiàn)以下錯(cuò)誤信息:
=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/bobo/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/simple_permissions-0.1.9/ios/Classes/SimplePermissionsPlugin.m:2:9: fatal error: 'simple_permissions/simple_permissions-Swift.h' file not found
#import
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
解決方法:
進(jìn)入flutter_project/ios/,編輯Podfile,將
# platform :ios, '9.0'
替換為:
platform :ios, '10.0'
use_frameworks!
關(guān)鍵是use_frameworks!
2、升級(jí)flutter后,高德地圖編譯失敗
報(bào)錯(cuò)信息:
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.
解決方法:在flutter的main里面添加下面一行代碼
WidgetsFlutterBinding.ensureInitialized();
這段代碼就行,代碼最高添加在main()函數(shù)的最上面,起碼要放在高德地圖初始化方法的前面
總結(jié)
以上是生活随笔為你收集整理的flutter引入高德地图_Flutter接入高德地图后运行报错的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 支付宝转账支付宝转卡(H5飞行模式)
- 下一篇: 欧洲共同语言标准 c1,[转载]BEC,