1.在导入插件执行完 flutter pub get 命令后,使用Xcode编译会报找不到相关头文件的错误,在GeneratedPluginRegistrant.m文件如下图所示位置:
GeneratedPluginRegistrant.m解决办法:在Xcode的 podfile 文件头部添加 use_frameworks! (若已经添加,请忽略),然后 pod install 就完美解决了。
2.Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
解决办法:
FlutterViewController *flutterVc = [[FlutterViewController alloc] init];[GeneratedPluginRegistrant registerWithRegistry:flutterVc];
3.bitcode
有时候在导入三方插件的时候,archive会报错,如下:
将导入的插件的bitcode关掉,可以解决,但是每次pod后又得重新手动关掉,将如下脚本放在podfile文件中
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name =="App" || target.name =="Flutter"
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] ='NO'
end
end
end
end
好像可以了,bug导入有些插件后还是会报错,最终在网上找了好久找到了解决方法
修改.ios工程中的bundleID和证书
执行 $Flutter build ios --release
执行 $pod install
bitcode修改为no
再archive
接着在工程中执行$pod install
修改bitcode,archive
4.Found 2 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.
$flutter packages pub run build_runner clean
$flutter packages pub run build_runner build --delete-conflicting-outputs
5.FormatException: Invalid number (at character 1)
这种类型的错误很难定位,特别是调试接口的时候,一定要仔细的检查(╥╯^╰╥)
int.parse('') 就会报如上错误
网友评论