当前位置:   article > 正文

flutter项目运行到IOS手机_android studio flutter 运行ios模拟器

android studio flutter 运行ios模拟器

1.通过Android studio可以看到创建ios模拟器的选项,但是点击创建会报错,原因是我没安装xcode
2.安装xcode,因为我mac版本是10.14,所以安装了xcode10.1,然后我flutter版本比较新,他最低支持的xcode版本是11,所以我又把flutter sdk插件降低了版本号。

git reset --hard cc949a8
  • 1

3.flutte版本降低后,

  • 运行flutter doctor,报错cocoapods没安装
    直接照着提示运行了sudo gem install cocoapods / pod setup,
  • 再运行flutter doctor,还是有问题,提示cocoapods已安装,但还是不能使用
    通过下面命令解决,是cocoapods版本号的问题,
    下载失败可以切换网络试试,下载时间比较久
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
  • 1
  • 2
  • 3

4.安装完成,再运行flutter doctor,就没有报错了
5. 打开xcode,录入appid和密码,运行模拟器,

提示:There are no devices registered in your account on the developer website. Plug in and select a device
解决方法:(期间各种修改bundle identifier,一直不管用,最后百度发现是因为我一直用的模拟器。用我自己的手机连一下就好了)
(把错误直译过来就是:
我们没有在开发者账号(Apple ID)上注册iOS设备(真机)
他让我们把iOS设备连上电脑,选择一个设备让Xcode自动帮我们注册一下。)
网址:https://blog.csdn.net/weixin_30974373/article/details/112710206
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  1. 接着运行报错
错误提示为:
/Runner.app/Frameworks/Flutter.framework:Permission denied
解决方法:
RunCommand find "${derived_dir}/engine/Flutter.framework" -type f -exec chmod a-w "{}"  \;
改为
RunCommand find "${derived_dir}/engine/Flutter.framework" -type f -iname '.h' -exec chmod a-w "{}" \;
网址; https://blog.csdn.net/Gemini_Kanon/article/details/106471945
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

7.再运行模拟器就可以安装成功了
8.flutter跑真机报错

 The service is invalid. AMDeviceSecureStartService(device, CFSTR("com.apple.debugserver"), NULL, &con)
Could not run build/ios/iphoneos/Runner.app on 00008030-0006686A3E63802E.
  • 1
  • 2

解决网址:https://www.jianshu.com/p/62c995282134
9.最后我还是运行不到我的手机上,我xcode版本是10,ios手机是14.1,期间试了各种方法,加14.1的支持包,都失败了 所以我放弃了,我怀疑是xcode太老了
10. 可以在Android studio 选择ios模拟器运行,也可以在xcode运行。(xcode的作用是安装ios模拟器和方便调试)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/885697
推荐阅读
相关标签
  

闽ICP备14008679号