Xcode 5.1 - No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)
What you need to do is just set the ONLY_ACTIVE_ARCH
to NO
(at least works for me). Below is a screenshot for it:
EDIT:
As far as I know (please point it out if there's something wrong, thanks), if you set ONLY_ACTIVE_ARCH
to YES
, it means the Xcode will only build for the active architecture (which refers to the device that's active in Xcode currently). Seems Xcode's default setting is set Debug to YES
, so it won't build binaries for other architectures when you only want to build for a special device that connected to your Mac.
The reason failed to build might be that, the project does not support the architecture of the device you connected. So the best solution is to add the right architecture for your device. Below is a list for architectures & the devices that support:
- ARMv8/ARM64:
iPhone 6
,iPhone 5s
,iPad Air
,Retina iPad Mini
- ARMv7s:
iPhone 5
,iPhone 5c
,iPad 4
- ARMv7:
iPhone 3GS
,iPhone 4
,iPhone 4S
,iPod 3G/4G/5G
,iPad
,iPad 2
,iPad 3
,iPad Mini
- ARMv6:
iPhone
,iPhone 3G
,iPod 1G/2G
So why "set the ONLY_ACTIVE_ARCH
to NO
" works? Because the device can still run the binary that built for all architectures you added (pass the build), but will lose some performance. This's just a quick solution, but not best.
Note: The more architectures you added, the bigger the binary will be generated. So it's good to choose right architectures for your project. ;)
I had the same error message after upgrading to XCode 5.1. Are you using CocoaPods? If so, this should fix the problem:
- Delete the "Pods" project from the workspace in the left pane of Xcode and close Xcode.
- Run "pod install" from the command line to recreate the "Pods" project.
- Re-open Xcode and make sure "Build Active Architecture Only" is set to "No" in the build settings of both the "Pods" project and your own project.
- Clean and build.
Add arm64
to the target's valid architectures
. Looks like it adds x86-64
architecture to simulator valid architectures as well.