为什么 iOS 模拟器需要 i386 和 x86_64 符号,即使我只在 x86_64 系统上?

Why does the iOS simulator require i386 and x86_64 symbols even though I'm on an x86_64 system only?

我正在尝试在模拟器上安装一个应用程序 运行,而之前这样做时遇到了一些问题。我们没有为 i386 构建 libjpeg.a,但它确实有 x86_64。这是唯一剩下的依赖项,但我想知道为什么我实际上需要 i386 符号,如果我在 x86_64 mac.

上 运行

iOS 模拟器可以在 32 位和 64 位模式下 运行 您的应用。这使您可以解决很多 64 位问题,并确保它已为 armv7 和 arm64 做好准备。为此,它会为 i386 和 x86_64 编译您的应用程序,并需要两种架构的库。

实际上 i386 架构适用于 iPhone 模拟器,而 x86_64 架构适用于 iPad 模拟器,两者都兼容 32 位和 64 位。

iOS 应用程序需要 运行 许多不同的架构:

arm7: Used in the oldest iOS 7-supporting devices
arm7s: As used in iPhone 5 and 5C
arm64: For the 64-bit ARM processor in iPhone 5S
i386: For the 32-bit simulator
x86_64: Used in 64-bit simulator

虽然这些天我尝试 运行 fastlane 来获取 iOS 屏幕截图,但我发现相同的 situation:Because 有 .a 库仅包含 x86_64架构,但没有i386架构,然后我得到这个错误:

Undefined symbol(s) for architecture i386

这是 运行在 iPhone 8 模拟器上使用 iOS 11.4

但您可以强制模拟器 运行 仅 64-bit 或仅 32-bit 如下:

Project -> Architectures -> set the value as:$(ARCHS_STANDARD_32_BIT) or $(ARCHS_STANDARD_64_BIT)