Xcode 14.3 Archiveでビルド失敗する Command PhaseScriptExecution failed with a nonzero exit code

# Xcodeを14.3にアップデートしてからArchiveでビルド失敗
普通にシュミレーターではビルドできても、なぜかArchiveするときのビルドが失敗しました。。。


```console
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/gen/Library/Developer/Xcode/DerivedData/Runner-aoyvbssntyfxuhfezgwaajbjclyj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-4AFD176ECFE3FEE34085CB5D.sh (in target 'Runner' from project 'Runner')
    cd /Users/gen/Desktop/basic/flutter/lovemageddon/ios
    /bin/sh -c /Users/gen/Library/Developer/Xcode/DerivedData/Runner-aoyvbssntyfxuhfezgwaajbjclyj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-4AFD176ECFE3FEE34085CB5D.sh

mkdir -p /Users/gen/Library/Developer/Xcode/DerivedData/Runner-aoyvbssntyfxuhfezgwaajbjclyj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/flutter_native_splash.framework" "/Users/gen/Library/Developer/Xcode/DerivedData/Runner-aoyvbssntyfxuhfezgwaajbjclyj/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks"
building file list ... rsync: link_stat "/Users/gen/Desktop/basic/flutter/lovemageddon/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/flutter_native_splash.framework" failed: No such file or directory (2)
done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/aaefcfd1-5c95-11ed-8734-2e32217d8374/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
```

全くわからず調べ続けていたところ、どうやらCocoaPodsの問題？っぽことが発覚:unamused:

# 環境

```terminal
flutter --version                                                                  (git)-[master]
Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b8f7f1f986 (5 months ago) • 2022-11-23 06:43:51 +0900
Engine • revision 8f2221fbef
Tools • Dart 2.18.5 • DevTools 2.15.0
```





# Pods-Runner-frameworksを編集
![Screenshot 2023-04-30 at 23.51.04.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/167220/dc04d884-5de4-6328-e27a-878348d51962.png)
`Flutter Project>ios>Runner.xcworkspace`からXcodeを開く


**左の検索バーで`source="$(readlink "${source}")"`を入れて検索し、readlinkの後ろに`-f`を追加**

```swift
source="$(readlink "${source}")" // before

source="$(readlink -f "${source}")" // after
```


# 参考
>回避策は、生成されたすべての ...-frameworks.sh ファイルを更新して、readlink の呼び出しに -f フラグを追加することです。 つまり、以下を置き換える必要があります。
source="$(readlink "${source}")"
と
source="$(readlink -f "${source}")"
これはCocoaPodsの問題のようです...


https://developer.apple.com/forums/thread/725230

https://developer.apple.com/forums/thread/727525