flutter|flutter run 报错 resource fork, Finder information, or similar detritus not allowed

笔者在运行flutter项目到iOS模拟器时,遇到如下报错:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...

Running Xcode build...


【flutter|flutter run 报错 resource fork, Finder information, or similar detritus not allowed】 ├─Assembling Flutter resources...5.1s
└─Compiling, linking and signing...7.6s
Xcode build done.17.4s
Failed to build iOS app
Error output from Xcode build:
?
** BUILD FAILED **
Xcode's output:
?
/Users/zzz/Desktop/pro/flutter/one/build/ios/Debug-iphonesimulator/Runner.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.


如果在当前目录下执行
xattr -rc .
再次运行flutter run,没什么问题,当再次运行的时候,又报同样的错误,每次运行都执行一次 xattr -rc . 感觉很傻了


完美解决:
1、关闭Xcode,打开终端:
2、进入DerivedData目录
cd ~/Library/Developer/Xcode/DerivedData/
3、然后再终端执行:
xattr -rc .
4、再运行flutter项目,完美解决

    推荐阅读