flutter项目运行到IOS手机

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

git reset --hard cc949a8

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

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.youkuaiyun.com/weixin_30974373/article/details/112710206
  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.youkuaiyun.com/Gemini_Kanon/article/details/106471945

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.

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值