flutter编译iOS项目问题汇总

1、The Swift pod `DKPhotoGallery` depends upon `SDWebImage`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` 

解决:在podfile文件中,找到【target 'Runner' do】这一行,换行加入【use_frameworks!】,注意不要带中括号【】。

2、`speech_to_text` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

解决:在podfile文件中,加入【ENV['SWIFT_VERSION'] = '5.0'】,同时在xcode工程中的Build Setting设置中,加入字段key:SWIFT_VERSION,值:5.0

3、Unexpected duplicate tasks

解决:在Xcode项目中找到Build Phases,在右上角搜索报错的具体文件名,然后去除重复的文件引用即可。

4、Flutter项目运行报错:[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig` in your build configuration (`Flutter/Debug.xcconfig`).

解决:在Xcode工程下,Flutter目录下,在Debug.xcconfig中添加:

#include? "Pods/Targets Support Files/Pods-Runner/PodsRunner.debug.exconfig"

在Release.xcconfig中添加:

#include? "Pods/Targets Support Files/Pods-Runner/PodsRunner.release.exconfig"
#include? "Pods/Targets Support Files/Pods-Runner/Pods-Runner.profile.exconfig"

5、Flutter项目运行报错:Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist'

解决:在flutter项目,先在pubspec.yaml文件中添加一个三方库,然后执行 【pub get】命令,之后在ios工程中会自动生成Podfile文件,切记不要使用pod命令自动创建,因为flutter工程默认创建的跟自己创建的内容不一样,就会导致以上问题。

6、The code signature version is no longer supported

解决

方式一:

Building Setting-- OTHER_CODE_SIGN_FLAGS

在你的调试模式下 添加:

–generate-entitlement-der

方式二:

查看所引用的库是否缺少,比如系统库libc++.tbb、libz.tbd

7、[!] No podspec found for `amap_flutter_location` in `../dzt/dzt/.ios/

解决:删除/Users/xxx/.pub-cache文件夹,然后在flutter工程中,重新拉取插件,flutter pub get,之后进入iOS工程中,使用命令 pod install 拉取三方依赖库即可。

猜你喜欢

转载自blog.csdn.net/u010263943/article/details/130750609