apollo-ios: Random compile errors in Xcode 13 generating the API file
Bug report
This is a very weird issue that seems to have recently started for us in Xcode 13. I’m, honestly not sure if this is an Xcode issue or Apollo, but wanted to check here first. Randomly, when building the project we get a compile failure on the autogenerated API file.
error: input file '~/.../API.swift' was modified during the build
I can switch back to Xcode 12 and everything builds correctly. We have changed nothing in our setup, other than trying out the Xcode 13 beta. If I completely remove the build phase to generate the API file then the project builds normally without any issues, since it is not modifying the API file.
Versions
Please fill in the versions you’re currently using:
apollo-ios
SDK version: 0.39.0- Xcode version: 13 beta 5
- Swift version: 5.5 (also same issue using 5.4)
- Package manager: SPM
Steps to reproduce
- Open project in Xcode 13 and build.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (8 by maintainers)
I also had this issue and this answer on StackOverflow resolved it.
Essentially added this line at the beginning of the build phase script:
I’m still having this issue with Xcode 13 final release 😞
@andyx227 If my understanding is correct, checking “install builds only” means that it will only ever run when doing a Product > Archive. This is likely not the desired behaviour. We want it to run anytime a build is performed and there are changes in the input graphql and/or schema files.
Thanks for this level of detail @Ded77 - I’ll keep trying to reproduce.
I have the same error for me with Xcode 13 RC 😕 Any updates about the Xcode possible bug with build phases order ?
Hi @calvincestari and @AnthonyMDev, we are definitely performing this build phase before the compile phase. I did not notice this with previous beta versions. I have also submitted feedback to Apple on this,
FB9565079
, but also wanted to check here to make sure that I wasn’t missing anything. 🙂Hopefully the next Xcode beta fixes this. 🤞
I’ll close this for now and then reach out again if I get more details on what is happening.
I’ve still not managed to replicate this issue but some suggestions are:
I realize neither of these are ideal nor solve the root issue but if this is becoming a bottleneck to productivity they may be worth trying.
I faced this yesterday with 0.49.1 (both cli & apollo) Though it is quite random… Now it works after few compiles…
Hi @Ded77 - I haven’t tried with the Release Candidate build yet. I will do so today and see if I can reproduce.