PLATFORM_PREFERRED_ARCHbuild setting is still resolved to x86_64 on M1 machines (see a report here). The aim of using PLATFORM_PREFERRED_ARCH was to find a default architecture to build.
PLATFORM_PREFERRED_ARCH values:
For Intel machines, it is:
building for simulator -> x86_64
building for device -> 'arm64'
For Apple silicon machines, it is:
building for simulator -> x86_64
building for device -> 'arm64'
Solution
Instead, we can recognize the architecture from the ARCHS env. For a default Debug configuration, it always resolves to a single architecture.
If "Build Archive Architecture Only" is disabled (not recommended), we can just the first one.
PLATFORM_PREFERRED_ARCH
build setting is still resolved tox86_64
on M1 machines (see a report here). The aim of usingPLATFORM_PREFERRED_ARCH
was to find a default architecture to build.PLATFORM_PREFERRED_ARCH values:
For Intel machines, it is:
x86_64
For Apple silicon machines, it is:
x86_64
Solution
Instead, we can recognize the architecture from the
ARCHS
env. For a defaultDebug
configuration, it always resolves to a single architecture. If "Build Archive Architecture Only" is disabled (not recommended), we can just the first one.ARCHS values:
For Intel machines, it is:
x86_64
arm64
For Apple silicon machines, it is:
arm64
arm64
when ONLY_ACTIVE_ARCH=NO
For Intel machines, it is:
arm64 x86_64
arm64
For Apple silicon machines, it is:
arm64 x86_64
arm64
Fixes #33