だいたい以下のようなエラー文
GoogleAppMeasurement/WithoutAdIdSupport/GoogleAppMeasurement.framework/GoogleAppMeasurement(APMAdExposureReporter.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file XCFrameworkIntermediates/GoogleAppMeasurement/WithoutAdIdSupport/GoogleAppMeasurement.framework/GoogleAppMeasurement' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
ENABLE_BITCODEをNOにしたらエラーを回避できるという記事をよく見かけたけど、うまくいかず...
結論
UnityFrameworkのENABLE_BITCODEもNOにしたらうまくいった。メインターゲットだけENABLE_BITCODEをNOにするだけだとエラー回避できなかった。
Unityのビルドのポストプロセスで処理する。だいたい以下のような感じ。
public static class XcodePostProcessBuild { [PostProcessBuild] public static void OnPostProcessBuild(BuildTarget target, string path) { if (target != BuildTarget.iOS) { return; } var project = new PBXProject(); project.ReadFromFile(PBXProject.GetPBXProjectPath(path)); project.SetBuildProperty(project.GetUnityMainTargetGuid(), "ENABLE_BITCODE", "NO"); project.SetBuildProperty(project.GetUnityFrameworkTargetGuid(), "ENABLE_BITCODE", "NO"); project.WriteToFile(PBXProject.GetPBXProjectPath(path)); } }