-->

Why does the iOS simulator require i386 and x86_64

2020-05-20 03:56发布

问题:

I'm trying to get an app running on the simulator that has had some problems doing so before. We don't have libjpeg.a built for i386, but it does have x86_64. This is the only dependency left, but I'm wondering why I actually need i386 symbols, if I'm running on an x86_64 mac.

回答1:

The iOS simulator can run your app in 32 and 64-bit modes. This is allows you to work out a lot of 64-bit issues and make sure it is ready for both armv7 and arm64. To do this, it compiles your app for i386 and x86_64 and requires the libraries for both architectures.



回答2:

iOS apps need to run on many different architectures:

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


回答3:

actually i386 architecture is for iPhone simulator where as x86_64 architecture is for iPad simulators, both are 32 and 64bit compatible.



回答4:

While these days I have tried to run Fastlane to get iOS screen capture, I found the same situation:Because there is .a library contains only x86_64 architecture,but without i386 architecture,and then I got this error:

Undefined symbol(s) for architecture i386

This is running on iPhone 8 simulator with iOS 11.4.

But you can force the simulator to run on only 64-bit or only 32-bit as follows:

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