M1芯片的Mac无法在模拟器上运行项目building for iOS Simulator或could not find module for target..

真机上可运行,模拟器上不行,并出现以下错误:

in xx/xx/arm64, building for iOS Simulator, but linking in object file built for iOS, file 'xx/xx'

1111111.png

could not find module for target 'x86_64-apple-ios-simulator'
解决方案
1.在项目的project和target的Build Setting里,搜excluded architectures,然后双击它,会弹出一个弹框,点击加号(如下图)添加arm64


11222.png
111333.png

2、在pod文件里面添加如下代码
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

3.回终端pod install一下

注:之后如需在真机上运行则需把上面第一步和第二步恢复原状,然后pod install一下。

(在上架App Store前也需这样做)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容