M1 芯片 下 framework 的问题

解决方案对Intel 芯片的Mac有效,M1 芯片Mac 有另外的问题

问题1

/Users/xxx/Documents/xxx Building for iOS Simulator, but the linked and embedded framework 'xxx.framework' was built for iOS + iOS Simulator.

解决方案

修改 Validate Workspace为Yes后,可以重新编译通过;之后可以改回成NO,就不会报错了。

图片.png

问题2

error build: Building for iOS Simulator, but linking in dylib built for iOS, file '/Users/***/XXX.framework/XXX' for architecture arm64

解决方案

因为苹果M1芯片用的是arm64的架构,而之前的mac是用的英特尔芯片。

所以要在 TARGET -> Architectures -> Excluded Architectures -> 添加arm64

同时在 pod项目里,也要 PROJECT -> Architectures -> Excluded Architectures -> 添加arm64

图片2.png

类似的问题
也可以再Podfile 对引入的库进行设置

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

Xcode 配置参考:
https://xcodebuildsettings.com

参考:
https://blog.csdn.net/qq_30185503/article/details/125376381

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

推荐阅读更多精彩内容