Could not find module ‘xxxxxxx‘ for target ‘arm64-apple-ios-simulator‘;

Xcode12 simulator compilation error

After upgrading Xcode to 12.0.1, the following error occurred in simulator compilation
Could not find module ‘xxxxxxx’ for target ‘arm64-apple-ios-simulator’; found: x86_ 64-apple-ios-simulator, x86_ 64
many methods have been found on the Internet, but they can’t be solved. Later, they have been solved through research. Here’s a record

First of all, make clear the concept

There is an architecture option in

    Xcode, and its value is standard architectures – $(arcs)_ Standard) is (armv7 and arm64) in real machine compilation, and (x86) in simulator compilation_ If the build active architectures only option in Xcode is yes, it means that only the current architecture will be compiled. For real computers, it is generally arm64, and the emulator is usually x86_ 64. If it is no, it means that the supported architectures are compiled at the same time. The exclusive architectures option in Xcode of the above architectures means that the excluded architectures are filled in here. Therefore, if arm64 is used here, it means that you do not want to compile the valid in Xcode_ As for the arcs option, it’s the current effective architecture (I’m also dizzy. Apple is so complicated that it needs this when it has 1). Generally, the value filled in here is the same as 1

    So here comes the question…. The problem I encountered was that I filled in arm64 arm64e in 4, so the compiler simulator kept reporting errors, and then changed all kinds of things, including the architecture of the third Library in pods.

    Solution
    although Standard Architecture (x86) is set in 1_ However, the effective architecture in 4 is arm64, arm64e, so only arm64 can be used for the simulator. (it is said that the simulator of xcode12 supports arm64, but my computer is i5, so this one doesn’t use arm64). So the module he compiled is for ‘arm64 Apple IOS simulator’, but the simulator is found: x86_ 64-apple-ios-simulator。 So I made a mistake if you encounter the same type of mistakes, you can think clearly about the relationship between 1, 2, 3 and 4.

    Pod component

    post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if config.name == 'Debug'
              config.build_settings["VALID_ARCHS"] = "arm64 arm64e x86_64 i386"
            else
              config.build_settings["VALID_ARCHS"] = "arm64 arm64e"
            end
        end
    end
    end
    

    Finally, the project clean recompile, OK

Read More: