赞
踩
//加载配置文件信息
$ flutter packages get
//升级版本
$ flutter upgrade
1)创建dart项目
$ cd 项目存储的目录
创建:$ dart create dart_base
$ cd dart_base
运行:$ dart run
2)创建flutter项目
$ cd 项目存储的目录
创建:$ flutter create flutter_demo
注:flutter中默认创建的ios项目是swift语言的,如果需要改成OC语言,使用以下命令创建
$ flutter create -i objc flutter_oc
open -a Simulator
flutter devices
cd 到根目录
flutter run -d all 启动所有项目
flutter run -d <设备id> 启动单个项目
flutter run -d
模拟器:BBA8D42C-9049-460C-A670-BB71711A01F1
真机:2414edd57dd317f4f322288ce3c890e104499e0f
问题一:ios ‘Flutter/Flutter.h’ file not found
问题二:did not find header ‘Flutter.h’ in framework ‘Flutter’
出现这个问题的原因可能是ios/Flutter 下的某些文件丢失
解决办法
1 新建一个flutter项目或用之前完整项目
2 copy 新项目中的 ios/Flutter 下的这些文件到原来的项目
flutter_export_environment.sh
Flutter.framework
Flutter.podspec
3 flutter clean
4 flutter run
问题:flutter pub get failed (66; Could not find a file named “pubspec.yaml“
解决方法:
1、打开Finder,选择-前往—前往文件夹—
2、输入路径如上 /Users/david/.pub-cache/hosted/pub.flutter-io.cn/dio-3.0.10
/Applications/flutter_3.0.1/.pub-cache
3、删除.pub-cache文件夹
4、重新执行flutter pub get
5、重新运行即可
问题:
2020-04-08 14:45:16.875 ios-ncn[38706:203108] [ !! ] Error 0xe800007f: Device doesn’t support wireless sync. AMDeviceStartService(device, CFSTR(“com.apple.debugserver”), &gdbfd, NULL)
Could not install build/ios/iphoneos/Runner.app on faae62f4d8b4ee9b0c3d85dd89226e203ffcf763.
Try launching Xcode and selecting “Product > Run” to fix the problem:
open ios/Runner.xcworkspace
Error launching application on chenfaniPhone.
解决办法:
// 终端执行命令
//选择flutter通道,一般都选择稳定版本stable
$ flutter channel // 之后选择“*”的分支 执行,例如flutter channcel stable
//检测flutter环境是否正常
$ flutter doctor
//更新flutter
$ flutter upgrade --force
问题:NoMethodError - undefined method `size’ for nil:NilClass
解决办法:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
pod install
ios flutter 运行 command phasescriptexecution failed with a nonzero exit code.
//此问题一般是代码问题,请先检查代码是否保存或报错
解决方法:卸载重装
flutter clean
rm -rf ios/Flutter/Flutter.framework
flutter build ios --release
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。