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).
3 Answers
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.

- 34,352
- 5
- 87
- 159
-
-
4This was also my issue after updating to xcode 5.1, it added it to my existing project. Not very nice! What's worse is all it would say is "Archive failed", no hint to the issue. Thanks for pointing this out. – Michael Mar 12 '14 at 01:30
-
5thanks a bunch for this answer!!! Apparently after I upgraded to Xcode w/ SDK7.1 it has automatically added the arm64 as a valid architecture to every single one of my projects!!! Removing arm64 was the solution!!! THANKS!!! – Chris Allinson Apr 02 '14 at 17:08
-
I have tried as you say @Rhytmic but still failed archive. Just I had change xcode 5 to xcode 5.1 – Ankur Loriya Nov 13 '14 at 15:44
For me the problem was that the scheme for "Archive" was different than the scheme for "Run". When i switched "Archive" to use DEBUG instead of RELEASE it worked.

- 697
- 6
- 16
-
Strangely this works for me too, but I don't think using the Debug Configuration is the right way to go. I think I'll fill it as a bug with Apple – Salman Hasrat Khan Dec 27 '14 at 18:03
-
@Darmen they acknowledged the bug and linked it to another one. I think they plan to fix it in the upcoming release although they haven't officially acknowledged it. – Salman Hasrat Khan Feb 09 '15 at 18:43
-
Archive is supposed to use release so it strips the debug symbols from the app and allows it to be used for app store distribution. – StackRunner May 13 '15 at 16:10
You can see reasons for failure in Report Navigator present in Navigator window.
Menu -> View -> Navigator -> Hide/Show Navigator
Extra icon will appear/disappear next to Breakpoint
icon after Hide/Show Navigator
Open Report Navigator
by pressing last button present on list of buttons in Navigator window.
Here you can view reasons either By Group
or By Time.

- 7,428
- 1
- 47
- 45