前言

Flutter开发中,iOS相关的常见问题,持续更新~

pub.flutter-io.cn缓存目录

点击每个项目的.packages即可查看,其所有的本地依赖包的缓存地址,我的地址为:

1
[Flutter Path]/.pub-cache/hosted/xxxpackage

PS:另外还有个老目录在/Users/smiacter/.pub-cache,为之前使用fvm时遗留下来的,应该没有用

安装Flutter SDK后运行Flutter doctor报错

  1. “dart” can’t be opened because Apple cannot check it for malicious software.
1
2
// 解决方法,终端输入以下命令,重新执行flutter doctorming'ling
sudo spctl --master-disable
  1. “idevice_id” cannot be opened because the developer cannot be verified
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// 解决方法,去设置允许权限,具体操作
1. 进入 system preference -> Security & Privacy
2. 在Allow apps downloaded from下面AppStore and identified developers 中同意(always allow),如果当时没有弹出来,可以退出了再进去查看
3. 再次执行Flutter doctor,如果是和idevice_id一样的权限问题,依次同意权限即可

// 另外一个方法 参考 https://medium.com/@alexandrosbaramilis/setting-up-flutter-on-macos-catalina-d023df8845ae
For "idevice_id" error:
sudo xattr -d com.apple.quarantine /Users/Your_User/Your_Dev_Folder/flutter/bin/cache/artifacts/libimobiledevice/idevice_id
For "ideviceinfo" error:
sudo xattr -d com.apple.quarantine /Users/Your_User/Your_Dev_Folder/flutter/bin/cache/artifacts/libimobiledevice/ideviceinfo
For "idevicesyslog" error:
sudo xattr -d com.apple.quarantine /Users/Your_User/Your_Dev_Folder/flutter/bin/cache/artifacts/libimobiledevice/idevicesyslog
For "iproxy" error:
sudo xattr -d com.apple.quarantine /Users/Your_User/Your_Dev_Folder/flutter/bin/cache/artifacts/usbmuxd/iproxy

VSCode iOS设置启动不了 报Error connecting to the service protocol: failed to connect to http://127.0.0.1:1029/89AGRYqn_pA 【Xcode没问题】

目前暂时没有找到好的方法,官方issue的答复大概是在Dev分支上得到了解决。把电脑的代理和网络关了,在模拟器上成功跑起来过一次,好多人的回答就是禁用WiFi等网络设置。