Cannot build to 4.2.1 device with Xcode 4.2

2019-07-31 19:13发布

问题:

I recently upgraded my project from Xcode 4.0.1 to Xcode 4.2 - and everything went pretty smoothly, I did some debugging in the simulator and then I decided to build with device.

My device is a 2nd gen iPod Touch running 4.2.1, so I initially attempted to build to it and got this error:

An unknown error message 'IncorrectArchitecture', was received from the device.

As you do with most error messages, I googled it, and found this question.

After reading the answer, I proceeded to check up on my target architectures, and it turns out I only had armv7 as an architecture to build for. - I added the armv6 architecture, as the answer suggests, but when I built it, I got a load of build warnings/errors such as:

ignoring file /some/path/to/a/staticlibrary.a, file was built for archive which is not the architecture being linked (armv6)

This occurs on all the static libraries in my project, such as the kal library - libkal.a and all the three20 libraries.

Those libraries linked fine in Xcode 4.0.2 - and it also built fine to my iPod - so why will the armv7 architecture not build AND the libraries not link for armv6 in Xcode 4.2? - I'm really confused - any suggestions would be greatly appreciated.

回答1:

Add ARMV6 to your build settings like this:

  1. Select your build settings
  2. Scroll to Architectures
  3. Doubletap on the existing entry
  4. Tap on +
  5. Enter armv6
  6. Tap on Done

You will need to do this for all projects that are linked with your app (e.g. three20).