I am working on an Xcode project that connects to a GraphQL API. To do this, I'm using the Apollo framework .
In my project, I've installed the cocoapod that includes the Apollo framework, and then added the following run script in Xcode:
if which apollo-codegen >/dev/null; then
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "warning: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 0
fi
cd "${SRCROOT}/${TARGET_NAME}/GraphQL"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate \
$(find . -name '*.graphql') \
--schema schema.json \
--output Generated/GraphQLAPI.swift
else
echo "Skipping Apollo code generation"
fi
This is how it looks in Xcode:
My directory structure in Xcode looks like this:
I then run the following command from Terminal:
npm install -g apollo-codegen
When I then try to build my Xcode project, I unfortunately get the following build error:
/Users/JohnDoe/Library/Developer/Xcode/DerivedData/The_Game-dfpiqreyqdjocaawjrfwhrxhdosf/Build/Intermediates.noindex/The Game.build/Debug-iphonesimulator/The Game.build/Script-7851AAFF2110C71000903FAD.sh: line 12: /Users/JohnDoe/Library/Developer/Xcode/DerivedData/The_Game-dfpiqreyqdjocaawjrfwhrxhdosf/Build/Products/Debug-iphonesimulator/Apollo/Apollo.framework/check-and-run-apollo-codegen.sh: No such file or directory
Why am I getting this error?