I've been building iOS apps for > 2 years and never encountered this problem. I am attempting to archive an app for beta distribution. The build succeeds, but at the very end of the process, Xcode reports 'Archive Cancelled'.
The build logs show no warnings or errors of any kind.
Sometimes, by cleaning/cleaning build folder/wiping derived data, I can get the archive to succeed, but there seems to be no pattern to it. Has anyone encountered this issue? I don't even have anything to go on as far as an error message in this case.
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons. One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Make sure your build is successful Before beginning to archive your build, you need to make sure that the build is successful not only for Debug, for also for Release.
On the Xcode menu, select Product -> Edit Scheme... In the Build section, add the new target, then uncheck all the boxes except the one in the Archive column. This ensures the script will only be run on Archive. (See this question for an explanation and a nice screenshot.)
Put this in a pre or post action (inside the Edit Scheme dialogue). It will bump all version numbers inside your project.
cd "${PROJECT_DIR}" ; agvtool bump
Here's my short blog post on the subject
After a ton of testing I realized a couple of things:
${PROJECT_DIR}
which prevents the change of directory to the project folder.agvtool
directly, instead of using xcrun
(at least when I have Xcode command line tools installed, I haven't tried this without them)First: +1 on ConfusedNoob's answer, because that was the problem (which led me to numerous experiments and finally this solution.) If my answer helps you, +1 his, too, because his hint was huge!
(Also, see my other answer, below, that bypasses agvtool altogether. I eventually settled-in to using that in all my projects.)
I've been messing with it a bit and the only thing I've found that works reliably to solve it is to use agvtool as a pre-action in the appropriate scheme(s), rather than as a run-script in the build-phases.
Run
and Archive
, but I probably only really need it on archive.Add your agvtool script. If you care, mine is:
cd ${PROJECT_DIR} ; xcrun agvtool next-version -all
(NOTE: pre-actions don't naturally run in ${PROJECT_DIR}
, so you have to cd
.)
Close & save and that's it.
The problem is that agvtool modifies the project file (unnecessarily, since all the build numbers we care about are elsewhere), and modifying the project file causes the build to cancel.
+1 one on the question, too -- cripes, that was a tough one!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With