Flutter iOS构建疑问:Podfile Target定义与模块配置
Flutter iOS构建问题排查记录
初始问题
- 构建Flutter iOS应用时失败,提示所有包需下载,不清楚Podfile中的"MyApp"应填写目录名还是应用名
- Android版本运行正常,想了解iOS构建与Android的差异,寻求包导入相关帮助
编辑1:Podfile路径错误问题
排查发现iOS目录下的pod install负责依赖安装,但执行时提示缺少podhelper.rb文件。从模板复制修改该文件后运行命令,出现路径错误:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/brandonpetroski/Desktop/ticket_board-master/ticket_board-master/ios in PATH, mode 040777 [!] Invalid `Podfile` file: cannot load such file -- ../ticket_board-master/ios/Flutter/podhelper.rb. # from /Users/prime/Desktop/ticket_board-master/ticket_board-master/ios/Podfile:14 # ------------------------------------------- # flutter_application_path = '../ticket_board-master' > load File.join(flutter_application_path, 'ios', 'Flutter', 'podhelper.rb') # # -------------------------------------------
编辑2:自动生成所需文件
删除Android版本中隐藏的flutter-plugins-dependencies等所有生成文件,重新打开项目后,VS Code自动生成了所需的文件,准备再次构建。
编辑3:cloud_firestore模块未找到错误
构建取得进展,但出现Module 'cloud_firestore' not found错误。
编辑4:CocoaPods配置警告
参考社区内容解决模块未找到问题:统一iOS版本为11.0并运行pod install获取所需依赖包,但出现CocoaPods配置警告:
[!] 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.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
编辑5:新的ARC语义错误
解决配置警告后,遇到新错误:
ARC Semantic Issue: no visible @interface for 'UIImage' declares the selector 'imageByPreparingForDisplay'
将针对此新错误单独提问,原问题已解决,希望本记录能帮助其他从Android转Flutter iOS构建的开发者。
内容的提问来源于stack exchange,提问作者Powermaster Prime
相关产品推荐
相关产品推荐

