When I try to compile using the build phase script in the guide, I get the following error:
.../Build/Products/Debug/Apollo/Apollo.framework/check-and-run-apollo-codegen.sh: No such file or directory
If I change the path in the build script from:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
to:
$APOLLO_FRAMEWORK_PATH/Versions/Current/Resources/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
It builds without error.
Ah, is this with a Mac target by any chance? The framework directory structure is different between iOS and Mac, so that would explain this.
Yep, absolutely. That makes sense. It's working fine with the workaround above. Any reason you know of why I shouldn't leave it like that?
No reason at all! This is how it is supposed to be set up on Mac. In fact, this should really be in the documentation.
Super! Thanks for the lightning quick reply!
I have a problem when I add build phase script ,
/Apollo/Apollo.framework/check-and-run-apollo-codegen.sh: No such file or directory
why
@cczufish The script has been renamed after codegen has been incorporated into the new Apollo CLI. See here for the correct build phase script.
@cczufish
Expand Generate Apollo GraphQL API in Build Phases
Replace ["${SCRIPT_PATH}"/check-and-run-apollo-cli.sh codegen:generate --target=swift --includes=.//.graphql --localSchemaFile="schema.json" API.swift]
to ["${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=.//.graphql --localSchemaFile="schema.json" API.swift]
Most helpful comment
@cczufish The script has been renamed after codegen has been incorporated into the new Apollo CLI. See here for the correct build phase script.