无法找到目标“x86_64-apple-ios-simulator”的模块“XXXX”;在 Swift 项目中找到:arm64、arm64-apple-ios-simulator?

roo*_*far 13 xcode ios swift

这个错误已经阻止我的项目进展一段时间了,似乎没有什么对我有用。

我已将 A pod 添加到我的 swift 项目中,但是当我尝试将其导入我的应用程序时,出现此错误:

Could not find module 'ImagePicker' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator
Run Code Online (Sandbox Code Playgroud)

我进行了广泛的搜索并尝试了几乎所有的解决方案,但似乎仍然没有任何效果。

我正在使用最新的 Xcode。

我需要做些什么来解决这个问题,因为这阻止了我构建应用程序。

Jon*_*Doe 7

我在 M1 笔记本电脑上也遇到同样的问题。您是否尝试过这个解决方案:

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end
end
Run Code Online (Sandbox Code Playgroud)

或者,您可以将默认方案更改为“发布”,而不是“调试”,方法是转到顶部菜单Product -> Scheme -> Edit Scheme,选择“运行方案”作为“发布”。

然而,更好的解决方案是简单地确保您正在使用 Rosetta 运行 Xcode。Get Info简单地在 Xcode 图标上执行此操作,然后在弹出窗口中确保Open using Rosetta选中该图标


Dav*_*Shi 5

我使用 SPM 进行依赖性管理,但我的 M1 笔记本电脑遇到了问题。我将顶级项目构建设置中的排除架构设置为arm64,这就是我遇到问题的地方 排除的架构

我删除后它起作用了。

这是进行更改后项目构建设置中的架构部分的屏幕截图(忽略暗模式外观,我正在切换笔记本电脑)。 项目构建设置