筆者在運行flutter項目到iOS模擬器時,遇到如下報錯:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
├─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項目,完美解決