Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode 5 archive build fail, but normal build successfully

Tags:

xcode

ios

build

ipa

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

like image 991
Arton Avatar asked Dec 04 '13 09:12

Arton


People also ask

Why is my Build failing in Xcode?

A common cause of failing builds is that Xcode Cloud can't access the Package. resolved file that it needs to resolve your Swift Package dependencies. To resolve issues related to the Package.

How do I archive a Build in Xcode?

Navigate to your project's settings. Under iOS (or the target you want to build your app for) > Identity, you'll want to increment the Build number. For example, if the Build number was 1, you'll want to set it to 2. Then, in the top menu, under Product, click on Archive.


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.

like image 107
Rhythmic Fistman Avatar answered Nov 02 '22 20:11

Rhythmic Fistman


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.

like image 27
Itay Bianco Avatar answered Nov 02 '22 19:11

Itay Bianco


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.

like image 44
Himanshu padia Avatar answered Nov 02 '22 19:11

Himanshu padia