MacOS环境下真机部署Flutter
作者:互联网
一、搭建MacOS下的Flutter环境
到官网下载Flutter SDK https://docs.flutter.dev/get-started/install/macos。下载完毕后,默认是放到Downloads文件夹下,然后就需要添加到PATH。
在终端输入如下命令:
export PATH=~/Downloads/flutter/bin:$PATH
OK之后就可以执行flutter doctor / flutter upgrade等命令了。
二、VSCode运行Flutter项目
此时用VSCode打开Flutter项目会有相应提示,主要有以下两步操作:
1. 设置Flutter SDK的路径为Downloads/flutter(这是我的下载的Flutter SDK的路径)。
2. 安装Dart扩展
安装成功之后就可以直接运行Flutter项目(VSCode-运行-以非调试模式运行),选择Dart&Flutter。
三、错误解决
1. cocoapods not installed
sudo gem install cocoapods
2. Could not build the precompiled application for the device.
══════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a
Provisioning Profile. Please ensure that a Development Team is selected by:
1- Open the Flutter project's Xcode target with
open ios/Runner.xcworkspace
2- Select the 'Runner' project in the navigator then the 'Runner' target
in the project settings
3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
You may need to:
- Log in with your Apple ID in Xcode first
- Ensure you have a valid unique Bundle ID
- Register your device with your Apple Developer Account
- Let Xcode automatically provision a profile for your app
4- Build or run your project again
For more information, please visit:
https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices
Or run on an iOS simulator without code signing
══════════════════════════════════════════════════════════════════════════
参考资料:
1. https://docs.flutter.dev/get-started/install/macos#deploy-to-ios-devices
标签:MacOS,下真机,Flutter,project,install,Team,flutter,your 来源: https://www.cnblogs.com/guwei4037/p/16061640.html