安裝最新的Xcodejavascript
安裝brewjava
下載 Flutter SDKios
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos#macos
複製代碼
把下載好的 Flutter SDK解壓到你想安裝SDK的目錄, 如:macos
/Users/liyuanqing/flutter
複製代碼
把 Flutter 安裝目錄和國內鏡像配置到環境變量vim
vim ~/.base_profilebash
export PATH=`pwd`/flutter/bin:$PATH
//如:export PATH=/Users/liyuanqing/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
複製代碼
source ~/.bash_profile (配置文件在修改後當即生效)
複製代碼
flutter -h (驗證flutter sdk是否配置成功)
複製代碼
運行Flutter doctor命令檢查是否須要安裝依賴項,完成安裝ide
flutter doctor
複製代碼
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v0.1.7, on Mac OS X 10.12.6 16G1212, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.0)
[!] iOS toolchain - develop for iOS devices (Xcode 9.2)
✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
[✓] Android Studio (version 3.0)
[✓] Connected devices (1 available)
複製代碼
分別執行brew -- 命令,如:學習
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy
複製代碼
提示:若是運行命令失敗,請執行brew doctor並按照說明解決問題。 ui
執行完以上命令,從新運行flutter doctor,出現下圖代表IOS的環境配置完成。spa
sudo flutter create flutterApp
複製代碼
cd flutterDemo
sudo chmod -R 777 flutterApp
複製代碼
-R遞歸,777可讀可寫可執行
cd /Users/liyuanqing/flutter
sudo chmod -R 777 *
複製代碼
首先下載vs code插件(dart、Flutter、Aweome Flutter Snippets)
在終端中運行flutter run
r:熱加載,p:顯示網格,o:切換操做系統
至此,Flutter IOS環境配置完成,示例正常運行,後續繼續學習Flutter的開發。