本文介绍: Coderliszt2021.04.24 22:33:37字数 277阅读 1,158<article class=”_2rhmJa“>这个M1芯片下Xcode 编译错误解决方案:Xcode版本:12.3M1芯片的Macbook pro选中模拟器进行编译时候,会报如下类似错误building for iOS Simulator, but linking in object file built for iOS, filexxx/Pods/WechatOp..

Coderliszt

2021.04.24 22:33:37字数 277阅读 1,158

<article class=”_2rhmJa”>

这个M1芯片下Xcode 编译错误解决方案
Xcode版本:12.3
M1芯片的Macbook pro

选中模拟器进行编译的时候,会报如下类似错误

building for iOS Simulator, but linking in object file built for iOS, file ‘xxx/Pods/WechatOpenSDK/WeChatSDK1.8.5/libWeChatSDK.a’ for architecture arm64

这个问题目应该只出现在M1芯片的Mac上,似乎又是一个兼容性问题,因为M1芯片的Mac本身就是arm架构,所以模拟器自然也支持arm架构。。。
目前的解决方案是,在编译设置中,对模拟器排除 arm64

一步:在项目的编译设置添加排除说明

image

第二步:在podfile添加,以免pod install覆盖需要pod工程中的设置

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
        end
    end
end

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注