在执行“lipo -create 路径1 路径2 -output 新文件路径”时报错have the same architectures (arm64)

62 阅读1分钟

fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: /Users/andylym/Library/Developer/Xcode/DerivedData/VerifyTypesFramework-dpvmvbfxkmjibwehkkfsfydqfntj/Build/Products/Debug-iphoneos/VerifyTypesFramework.framework/VerifyTypesFramework and /Users/andylym/Library/Developer/Xcode/DerivedData/VerifyTypesFramework-dpvmvbfxkmjibwehkkfsfydqfntj/Build/Products/Debug-iphonesimulator/VerifyTypesFramework.framework/VerifyTypesFramework have the same architectures (arm64) and can't be in the same fat output file

问题出在尝试将具有相同架构(arm64)的真机和模拟器版本的框架合并到一个fat文件中。具体来说,真机版本和模拟器版本的VerifyTypesFramework.framework都包含了arm64架构,而lipo工具要求合并的文件必须具有不同的架构,或者至少其中一个文件需要排除重复的架构。

解决方法

排除模拟器中的arm64架构

  1. 打开Xcode项目
  • 打开你的Xcode项目,选择你的目标(target)。
  1. 设置排除架构
  • 进入Build Settings选项卡。
  • 找到Excluded Architectures设置。
  • 为Debug和Release配置添加Any iOS Simulator SDK,并设置其值为arm64。
  1. 重新编译
  • 清理并重新编译项目,确保模拟器版本的框架不再包含arm64架构。
  1. 使用lipo合并
  • 使用lipo命令合并真机和模拟器版本的框架:

lipo -create /Users/andylym/Library/Developer/Xcode/DerivedData/VerifyTypesFramework-dpvmvbfxkmjibwehkkfsfydqfntj/Build/Products/Debug-iphoneos/VerifyTypesFramework.framework/VerifyTypesFramework /Users/andylym/Library/Developer/Xcode/DerivedData/VerifyTypesFramework-dpvmvbfxkmjibwehkkfsfydqfntj/Build/Products/Debug-iphonesimulator/VerifyTypesFramework.framework/VerifyTypesFramework -output /path/to/output/VerifyTypesFramework

通过以上方法,你应该能够解决由于架构冲突导致的lipo错误。选择适合你项目的方法进行操作即可。