Flutter requires the Rosetta translation environment

一般是 SDK 里面的工具还是旧的,没有适配 Apple ARM 平台,所以在 iOS/iPad 上面调试的时候会出现下面的报错,让我们装兼容层:

Installing and launching...                                            
The Dart VM Service was not discovered after 60 seconds. This is taking
much longer than expected...
Installing and launching...                                              227.0s
0.5
0.5
Error: Flutter failed to run
"/Users/bgzo/fvm/versions/3.41.9/bin/cache/artifacts/libusbmuxd/iproxy
49822:49622 --udid 00008130-000131EC1091401C".
The binary was built with the incorrect architecture to run on this
machine.
If you are on an ARM Apple Silicon Mac, Flutter requires the Rosetta
translation environment. Try running:
  sudo softwareupdate --install-rosetta --agree-to-license

卧槽,怎么可能,我们只需要干掉这个 x86 的包即可:

# 先看下本机有没有装 iproxy, 没有的话用 brew 装一下 libimobiledevice
which iproxy
 
# 然后 删除对应 SDK 里面的 X86 的包
mv /Users/bgzo/fvm/versions/3.41.9/bin/cache/artifacts/libusbmuxd/iproxy /Users/bgzo/fvm/versions/3.41.9/bin/cache/artifacts/libusbmuxd/iproxy.bak
 
# 重新链接
ln -s /opt/homebrew/bin/iproxy /Users/bgzo/fvm/versions/3.41.9/bin/cache/artifacts/libusbmuxd/iproxy

重新起服务

fvm flutter run