The iOS Simulator deployment target is set to 4.3解决
- 发表于
- flutter
在ios模拟器上调试的时候出现错误信息:The iOS Simulator deployment target is set to 4.3...
原来是因为ios 版本问题,于是找到资料是在 Podfile文件中添加判断
1 |
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0 config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0' end end endend |
接着又报错,Using new build systemnote: Planning buildnote
查资料原来是要升级 cocospod,于是百度了下,
1. 检测gem版本
1 |
$ gem -v |
如果gem版本小于2.6.x,则需要更新gem
2. 更新gem(gem版本高于2.6.x可跳过此步)
- 检测ruby源,更新gem需要官方的ruby源
1 |
$ gem sources -l |
- 替换ruby源为官方地址(如果ruby源是"https://rubygems.org/"则跳过此步)
1 |
$ gem sources --add https://rubygems.org/ --remove xxx.xxx |
- 确保ruby源中只有"https://rubygems.org/"
1 |
$ gem sources -l |
- 更新gem(此步要翻墙)
1 |
$ gem update --system |
- 查看gem版本,确认大于2.6.x
1 |
$ gem -v |
- 将ruby源切换回国内的
1 |
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ |
- 确保只有"https://gems.ruby-china.com/"一个ruby源
1 |
$ gem sources -l |
3. 更新cocoapods
1 |
$ gem install cocoapods -n /usr/local/bin |
结果还是不行
xcode报错:
1 2 3 4 5 6 7 |
Xcode's output: ↳ /Users/maxiang/Documents/maxiang/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver-1.2.2/ios/Classes/ImageGallerySaverPlugin.m:2:9: fatal error: 'image_gallery_saver/image_gallery_saver-Swift.h' file not found #import <image_gallery_saver/image_gallery_saver-Swift.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. note: Using new build systemnote: Planning buildnote: Constructing build description |
android也报错,最后看有人说是因为版本问题,建议换个插件。
目前使用的插件是:
1 |
image_gallery_saver: ^1.2.2permission_handler: ^4.2.0+hotfix.3 |
原文连接:The iOS Simulator deployment target is set to 4.3解决
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。