0

I'm trying to run an app for a client, and I keep going through this error:

enter image description here

The app is using a Cocoapod called Apollo, fully updated. I'm using Xcode 13.3, on a 2018 Macbook Pro

I've tried some solutions like:

  • Reinstall the pod (deleting the line in Podfile, updating, adding again and cleaning the build)
  • Change the script on Build Phases to match this answer
  • And I searched and found schema files like this answer
  • I've also read the Apollo documentation and found nothing wrong with the code or scripts in the app.

In my target BuildPhases/Run Script, I have the following code:

APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO__FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi

cd "${SCROOT}/${TARGET_NAME}/Api/PrivateAPI"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --passthroughCustomScalars --schema=schemaPrivate.json PrivateAPI.swift
cd "${SCROOT}/${TARGET_NAME}/Api/PublicAPI"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --passthroughCustomScalars --schema=schemaPublic.json PublicAPI.swift

1 Answers1

0

I found a solution. Since the code was made in 2018, seems like the Apollo pod had some changes. I changed my BuildPhases/Run Script to this code, like the Apollo documentation asks:

if [ $ACTION = "indexbuild"]; then exit 0; fi

SCRIPT_PATH="${PODS_ROOT}/Apollo/scripts"

cd "${SRCROOT}/${TARGET_NAME}/API/PublicAPI"
"${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./****.graphql --localSchemaFile="schemaPublic.json" PublicAPI.swift

cd "${SRCROOT}/${TARGET_NAME}/API/PrivateAPI"
"${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./****.graphql --localSchemaFile="schemaPrivate.json" PrivateAPI.swift

That worked for these error.