1:第一步找到其他xcode项目,拷贝一份Runner.Xcodeproj文件到.iOS目录下,在cd到.iOS目录下执行
pod init
image.png
2:生成好Podfile文件后执行
pod install --verbose --no-repo-update
3:cd到原生项目下执行
pod install
可能遇到的问题
The current Dart SDK version is 2.12.0.
Because my_flutter requires SDK version >=2.17.0 <3.0.0, version solving failed.
解决方法:mac下配置Flutter环境变量
- 执行打开.bash_profile文件的命令:
open -e .bash_profile
2.打开.bash_profile文件后直接在最末尾处追加设置flutter环境变量:
export FLUTTER_HOME=/Users/nihisashi/Desktop/FlutterSDK3/flutter
export PATH=$PATH:/Users/nihisashi/Desktop/FlutterSDK3/flutter/bin
export PATH=$PATH:/Users/nihisashi/Desktop/FlutterSDK3/flutter/bin/cache/dart-sdk/bin
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
可能遇到的问题二
执行 flutter doctor
会提示 【zsh: command not found: flutter】
解决方案一:
每次打开终端都需要先输入source .bash_profile,再使用flutter命令
可能遇到的问题三
No podspec found for Flutter
in ../my_flutter/.iOS/Flutter/engine
到其他flutter项目目录下,拷贝一份Flutter.podspec文件到该目录下
网友评论