xcode 5 archive build fail, but normal build successfully

Arton picture Arton · Dec 4, 2013 · Viewed 12.7k times · Source

I can build and run my app on my device, but when I tried to build archive, I got many errors. The errors are about my 3rd library - google protobuf. It showed that #error Host architecture was not detected as supported by protobuf. But what is the difference between archieve and normal build?? After all, I built successfully and ran my app on the device when I choose product=>run (cmd+R).

Answer

Rhythmic Fistman picture Rhythmic Fistman · Dec 4, 2013

When you build to run, Xcode usually builds for the active architecture only. When you archive it builds all the architectures specified by the intersection of the Build Settings "Architectures and Valid Architectures".

So it's likely that Xcode is trying to build for some architecture that isn't supported by your protobuf library, e.g. Arm64.