1、flutter开发接入高德地图包后运行报下面错误信息
fatal error: 'simple_permissions/simple_permissions-Swift.h' file not found
运行在iPhone手机时出现以下错误信息:
=== 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 <simple_permissions/simple_permissions-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
解决方法:
进入flutter_project/ios/,编辑Podfile,将
# platform :ios, '9.0'
替换为:
platform :ios, '10.0'
use_frameworks!
关键是use_frameworks!
2、升级flutter后,高德地图编译失败
报错信息:
[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()函数的最上面,起码要放在高德地图初始化方法的前面